0
Can someone please help me in debug that code
#include<iostream> using namespace std; class A { public: virtual void show() { cout<<"parent class is A"<<endl; } }; class B: public A { public: void show() { cout<<"child class B is"<<endl; } }; class C: public A { void show() { cout<<"child class C is"<<endl; } }; int main() { A obj1; B obj2; C obj3; ptr=&obj1; ptr->show(); ptr=&obj2; ptr->show(); ptr=&obj3; ptr->show(); return 0; }
2 Answers
+ 2
I guess "A *ptr" Is missing