#include < iostream >
using namespace std;
class Base{
public: virtual void fun()=0;
};
class derived:private Base{
private: void fun(){
cout < < "accessing private method" < < endl;
}
};
int main(){
Base *base;
derived *dptr = new derived();
base = (Base *)dptr;
base- > fun();
return 0;
}
No comments:
Post a Comment