标签:
class base{
public:
virtual void display(){ cout << "base" << endl; }
};
class drive : private base{
public:
virtual void display(){ cout << "drive" << endl; }
};
int _tmain(int argc, _TCHAR* argv[])
{
//base* b = new drive; //error
base* b = (base*)new drive; //right
b->display(); //drive
}
标签:
原文地址:http://www.cnblogs.com/lelezhangzhao/p/5467862.html