提交 9167b4d0 编写于 作者: W wsb

总结多态的使用规律

上级 936b2886
......@@ -30,6 +30,9 @@ int main() {
animal->print();
animal->ability();
/*总结:
1.当父类仅有常规函数和非纯虚函数时,子类继承过来的函数只要函数名称相同会覆写父类函数;
2.当父类有纯虚函数时,子类必须实现父类的纯虚函数;*/
return 0;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册