//p2.cpp -- demo NOT polymorphism, note that the "virtual" is comment out #include using namespace std; class Shape { public: //virtual // comment out this line and test again ? void draw( ) { cout << "aaa "; } }; // Shape class Line: public Shape { public: void draw( ) { cout << "LLL "; } }; struct Circle: public Shape { // struct{ === class { public: void draw( ) { cout << "ccc "; } }; int main( ) { Shape * p; p = new Shape( ); p->draw( ); p = new Line( ); p->draw( ); p = new Circle( ); p->draw( ); cout << endl; } /***** 11:06am ccbsd2:polymorphish/> g++ p2.cpp 11:06am ccbsd2:polymorphish/> ./a.out aaa aaa aaa 11:06am ccbsd2:polymorphish/> *****/