bugfix:基类引用指向基类实例
This commit is contained in:
parent
f1aff8acc8
commit
ad6c3c0d70
@ -86,7 +86,7 @@ int main(void)
|
|||||||
Base &p = d; // 基类引用指向派生类实例
|
Base &p = d; // 基类引用指向派生类实例
|
||||||
cout<<"基类对象直接调用"<<endl;
|
cout<<"基类对象直接调用"<<endl;
|
||||||
ptr.fun1();
|
ptr.fun1();
|
||||||
cout<<"基类引用指向派生类实例"<<endl;
|
cout<<"基类引用指向基类实例"<<endl;
|
||||||
pp.fun1();
|
pp.fun1();
|
||||||
cout<<"基类指针指向派生类实例并调用虚函数"<<endl;
|
cout<<"基类指针指向派生类实例并调用虚函数"<<endl;
|
||||||
pt->fun1();
|
pt->fun1();
|
||||||
|
Loading…
Reference in New Issue
Block a user