NTU-OOP-Tuts-2024-Cpp/T9Q2/main.cpp

19 lines
296 B
C++
Raw Normal View History

2024-11-05 10:34:51 +08:00
#include <iostream>
using namespace std;
class BC {
public:
void show(void) { cout << " \n I am in base class.."; }
};
class DC : public BC {
public:
void show(void) { cout << " \n I am derived class.."; }
};
int main()
{
BC* ptr1;
DC dobj;
ptr1 = &dobj;
ptr1->show();
}