예제 #1
0
int main()
{
	Drive  d;

	cout << d.show() <<endl;
	cout << d.show_protected_data() <<endl;


	Drive *dd = new Drive;
	Base *b = dd;	//静态是Base动态是Drive
	b->v_func(); //结果是d data: 0  指针是所以调用动态函数但是参数是静态 就是base的 0

	b->no_virtual();//结果是Base类的函数


	Drive_private *pd = new Drive_private;
	cout << pd->show_protected_data() <<endl;
	
	//pd->acessy_pubilc_inhirit(); //error  不能被获取
	
}
예제 #2
0
int main(int argc, char* argv[]){
    Drive d;
    d.show();

    return 0;
}