I think this tutorial on tutsplus, can hel you. But i think the point if to make a class use another class, with a interface or abstract class, than can you switch at every moment, like in the example a ebook reader that can read books in pdf, epub, and another format. Valid too for example an email sender that works with mandril, phpmailer, swiftmail or another library of mails, or for example an authenthication.
If anyone think I may be wrong or can add more info, are welcome :)
PS: I think this article can give you some light. And i recomend you read about SOLID for better code