#include<iostream> using namespace std; class A { public: virtual void print() {cout << "a" << endl;} }; class B: public A { public: void print() {cout << "b" << endl;} }; class C: public A { public: void print() {cout << "c" << endl;} }; int main() { A a; B b; C c; // a.print(); // b.print(); // c.print(); A *p=&a; A *p1=&b; A *p2=&c;