有如下程序:    #include<iostream>    using namespace std;    class BASE    {        public:        ~BASE(){cout<<"BASE";}    };    cl

admin2017-10-17  24

问题 有如下程序:    #include<iostream>    using namespace std;    class BASE    {        public:        ~BASE(){cout<<"BASE";}    };    class DERIVED:public BASE    {    public:        ~DERIVED(){cout<<"DERIVED";}    };    int main(){DERIVEDx;retum 0;}    执行后的输出结果是

选项 A、BASE
B、DERIVED
C、BASEDERIVED
D、DERIVEDBASE

答案D

解析 本题考查基类析构函数和派生类析构函数的调用次序。
转载请注明原文地址:https://kaotiyun.com/show/CJAp777K
0

最新回复(0)