#include iostreamusing namespace std;class Base int ab; public Baseint xint y a=x;b=y;void show cout a=a b=b; ;class Derivedpublic Base int c;publicDerivedint xint yint zBasexy c=z;void show Basesho
调用的是Derived派生类的show()函数;函数"show()"称为虚函数,实现了动态多态性。
原文地址: https://www.cveoy.top/t/topic/eYYi 著作权归作者所有。请勿转载和采集!