class Parent {
public:
~Parent() { }
virtual void method() { }
};
class Child : public Parent {
public:
Child() { /* creating resources */ }
~Child() { /* cleaning resources */ }
void method() { /* code */ }
};
int main() {
Parent * obj = new Child;
// code
delete obj;
return 0;
}
Login in to like
Login in to comment