题库 软件开发 题目列表 下列代码中的输出是(): class Base { public:...
单选题

下列代码中的输出是():

class Base {
public:
Base()
{ cout<<"Constructing Base \n"; }
~Base()
{ cout<<"Destructing Base \n"; }
};
class Derived: public Base {
public:
Derived()
{ cout<<"Constructing Derived \n"; }
~Derived()
{ cout<<"Destructing Derived \n"; }
};

int main(void)
{
Derived *d = new Derived();
Base *b = d;
delete b;
return 0;
}



A.


Constructing Base

Constructing Derived

Destructing Base



B.

Constructing Base

Constructing Derived

Destructing Derived

Destructing Base

C.

Constructing Base

Constructing Derived

Destructing Base

Destructing Derived

D.

Constructing Derived

Constructing Base

Destructing Base

Destructing Derived

题目信息
校招真题
-
正确率
0
评论
17
点击