#include "stdio.h"
class Parent {
public:
void GetValue() { Count(); }
private:
virtual void Count() { printf("%d", 1); }
};
class Child : public Parent {
private:
void Count() { printf("%d", 2); }
};
int main() {
Parent * obj = new Child;
obj->GetValue();
return 0;
}
Login in to like
Login in to comment