有如下程序:
include <iostream>
using namespace std;
class PARENT
{
public:
PARENT() { cout <<"PARENT"; }
};
class SON : public PARENT
{
public:
SON() {cout << "SON"; }
};
int main()
{
SON son;
PARENT *p;
p = &son;
return 0;
}
执行上面程序的输出是______。
第1题:
有如下程序: #include<iostream> using namespace std; class BASE{ public: ~BASE( ){cout<<"BASE";} }; class DERIVED:public BASE{ public: ~DERIVED( ){cout<<"DERIVED";} }; int main( ){DERIVED x;return 0;} 程序的输出结果是
A.BASE
B.DERIVED
C.BASEDERIVED
D.DERIVEDBASE
第2题:
有如下程序: #include <iostream> using namespace std; class AA { public: virtual void f() { cout<< "AA"; } }; class BB : public AA { public: BB() { cout << "BB"; } }; cla
A.AA
B.AABBCC
C.BBAABBCC
D.BBBBAACC
第3题:
有如下程序: #include <iostream> using namespace std; class A { public: A() {cout<<"A";} }; class B {public:B() {cout<<"B";}}; class C: public A { Bb; public: C() {cout<<"C";} }; int main() {C obj;return 0;}执行后的输出结果是 ______。
A.CBA
B.BAC
C.ACB
D.ABC
第4题:
有如下程序: #include<iostream> using namespace std; class A { public: A(){cout<<"A";} }; class B{public:B(){cout<<"B";} }; class C:public A { B b; public:C(){cout<<"C";} }; int main() { C obj; return 0; } 执行后的输出结果是( )。
A.CBA
B. BAC
C.ACB
D.ABC
第5题:
有如下程序:
include<iostream>
using namespaee std;
class A{
public:
A( ){cout<<"A";}
~A( ){cout<<"A";}
};
class B{
A a;
public:
B( ){cout<<"B";}
~B( )t cout<<"B";}
};
int main( ){
B b;
return 0;
}
程序的输出结果是______。