#include using namespace std; class Example1 { public: virtual void func()const = 0; }; class Example2:public Example1 { public: void func()const { cout << "HelloWorld" << endl; } }; void show(const Example1 * ex) { ex->func(); } int main() { Example1* ex1 = new Example2(); show(ex1); //HelloWorld delete ex1; return 0; }