网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
以下程序的执行结果是【】。 include using namespace std; class base { public: virmal
以下程序的执行结果是【 】。
include<iostream>
using namespace std;
class base
{
public:
virmal void who(){cout<<"Base Class"<<endl;)
};
class Derivedl:public Base
{
public:
virtual void who(){cout<<"Derivedl Class"<<endl;}
};
class derived2:public Base
{
public:
virtual void who(){cout<<"Derived2 Class"<<endl;)
};
int main(int argc,char*argv[])
{
base obj1,*P;
deliVedl obj2;
derived2 obj3;
p=&obj1; p->who();
p=&obj2; p->who();
p=&obj3; p->who();
return 0;
}
参考答案
更多 “ 以下程序的执行结果是【】。 include using namespace std; class base { public: virmal 以下程序的执行结果是【 】。include<iostream>using namespace std;class base{public:virmal void who(){cout<<"Base Class"<<endl;)};class Derivedl:public Base{public:virtual void who(){cout<<"Derivedl Class"<<endl;}};class derived2:public Base{public:virtual void who(){cout<<"Derived2 Class"<<endl;)};int main(int argc,char*argv[]){base obj1,*P;deliVedl obj2;derived2 obj3;p=obj1; p->who();p=obj2; p->who();p=obj3; p->who();return 0;} ” 相关考题
考题
有如下程序: #include<iostream) using namespace std; classBASE{ public: ~BASE(){cout<<“BASE”;} }; class DERIVED:public BASE{ public: ~DERIVED(){COUt<<“DERIVED”;} }; int main(){DERIVED x;return 0;} 执行后的输出结果是( )。A.BASEB.DERIVEDC.BASEDERIVEDD.DERIVEDBASE
考题
有如下程序: include using namespace std; class BASE { public
有如下程序: #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.BASEB.DERIVEDC.BASEDERIVEDD.DERIVEDBASE
考题
有如下程序:include using namespace std;class BASE{public:~BASE(){cout
有如下程序: #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.BASEB.DERIVEDC.BASEDERIVEDD.DERIVEDBASE
考题
有如下程序:include using namespace std;class BASE{public:~BASE() {cout
有如下程序: #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.BASEB.DERIVEDC.BASEDERIVEDD.DERIVEDBASE
考题
以下程序执行结果是 ( )。include class Base{public virtual void fun() {cout
以下程序执行结果是 ( )。 #include <iostream.h> class Base { public virtual void fun() { cout<<"B"; } }; class Derived { public: Derived() { cout<<"D"; } virtual void fun(){ Base::fun(); cout<<"C"; } } int main () { Base *ptr; Derived obj; ptr=obj; p->fun ( ); return 0; }A.DBCB.DCBC.BDCD.CBD
考题
有以下程序include using namespace std:class Base{private:char c;public:Base(cha
有以下程序#include <iostream>using namespace std:class Base{private: char c;public: Base(char n) :c(n) {} ~Base ( ) { cout<<c; }}; class Derived : public Base{private: char c;public: Derived(char n):Base (n+1),c(n) {} ~Derived() { cout<<c; }};int main(){ Derived obj('x'); return 0;} 执行后的输出结果是A.xyB.yxC.xD.y
考题
有以下程序:include using namespace std;class Base{public:Base(){}virtual void w
有以下程序: #include <iostream> using namespace std; class Base { public: Base(){} virtual void who() { cout<<"Base Class"<<end1; } ~Base(){} }; class Derivel : public Base { public: void who() { cout<<"Derivel Class"<<end1; } }; class Derive2 : public Base { public: void who () { cout<<"Derive2 Class"<<end1; } }; int main () { Base *p; Derivel obj1; Derive2 obj2; p=obj1; p=obj2; p->who ( ); return 0; } 执行程序后的输出结果是( )。A.Base ClassB.Derivel ClassC.Derive2 ClassD.程序编译时出错
考题
有如下程序:includeusing namespace std;class BASE{public:~BASE(){cout
有如下程序: #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.BASEB.DERIVEDC.BASEDERIVEDD.DERIVEDBASE
考题
有以下程序includeusing namespace std;class Base{private:char c;public:Base(char
有以下程序 #include<iostream> using namespace std; class Base { private: char c; public: Base(char n):c(n){} ~Base() { cout<<c; } }; class Derived:public Base { private: char c; public: Derived(char n):Base(n+1),c(n){} ~Derived() { cout<<c; } }; int main() { Derived obj('x'); return 0; } 执行后的输出结果是A.xyB.yxC.xD.y
热门标签
最新试卷