#include /* this is an abstract class in C++ */ class Honkable { public: void honk(int n) { for (int i = 0; i < n; i++) { std::cout << "honk!"; } std::cout << std::endl; } }; /* a concrete implementation */ class Car : public Honkable { public: void honk(int n) { for (int i = 0; i < n; i++) { std::cout << "beep!"; } std::cout << std::endl; } }; void honk(Honkable *h, int n) { // honk it! h->honk(n); } int main() { Car *h1 = new Car(); // this does not do what we want! honk(h1, 5); // we have to "pay" for this feature! }