#include #include using namespace std; class base { public: virtual ~base() {} virtual void implementation() const = 0; void interface() const {implementation();} }; class derived1: public base { public: void implementation() const {cout << "derived1\n";} }; class derived2: public base { public: void implementation() const {cout << "derived2\n";} }; int main() { derived1 d1; d1.interface(); derived2 d2; d2.interface(); cout << "sizeof (base) == " << sizeof (base) << "\n" << "sizeof (derived1) == " << sizeof (derived1) << "\n" << "sizeof (derived2) == " << sizeof (derived2) << "\n"; return EXIT_SUCCESS; }