From 9167b4d0233c061d02863f25fea37a46d927612c Mon Sep 17 00:00:00 2001 From: wsb <1234@qq.com> Date: Sun, 9 Apr 2023 10:27:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=BB=E7=BB=93=E5=A4=9A=E6=80=81=E7=9A=84?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E8=A7=84=E5=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.cpp b/main.cpp index 93821a6..4478de8 100644 --- a/main.cpp +++ b/main.cpp @@ -30,6 +30,9 @@ int main() { animal->print(); animal->ability(); + /*总结: + 1.当父类仅有常规函数和非纯虚函数时,子类继承过来的函数只要函数名称相同会覆写父类函数; + 2.当父类有纯虚函数时,子类必须实现父类的纯虚函数;*/ return 0; } -- GitLab