bugfix:基类引用指向基类实例

This commit is contained in:
Francis 2020-04-23 09:09:45 +08:00 committed by GitHub
parent f1aff8acc8
commit ad6c3c0d70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,7 +86,7 @@ int main(void)
Base &p = d; // 基类引用指向派生类实例
cout<<"基类对象直接调用"<<endl;
ptr.fun1();
cout<<"基类引用指向派生类实例"<<endl;
cout<<"基类引用指向类实例"<<endl;
pp.fun1();
cout<<"基类指针指向派生类实例并调用虚函数"<<endl;
pt->fun1();