Output of the code snippet will be:
#includeiostream
using namespace std;
class Test1
{
public:
virtual void show() {
cout"Hello from Test1"endl;
}
};
class Test2:public Test1
{
public:
void show() {
cout"Hello from Test2"endl;
}
};
int main(void)
{
Test2 obj;
obj.show();
return 0;
}


Posted on by