Mmh I think I have an example for you.
Let's say you have a shop where you sell books and ebooks. Now not all books are available as downloadable content and not every book is available as a hard copy right. But some books have both. So for each book the action after purchasing is different. So either ship the book or download the book
So you have a base class called book and then for each possibility you have an implementation for that.
class Book
{
public function getTitle();
public function getSummary();
public function purchase();
}
class DownloadableBook extends Book
{
public function purchase()
{
// Perform the download action
}
}
class PhysicalBook extends Book
{
public function purchase()
{
// Perform the shipping thing
}
}
I believe this is a correct example ;)