若有以下程序:include using namespace std;class Base{public: void who(){cout 若有以下程序:include <iostream>using namespace std;class Base{public:void who(){cout<<" Base"<<end1:}};class Derived1: public Base{public:void who(){ cout<<"Derived"<<end1;}};int main(){Base *p;Derived1 obj1;p=obj1;p->who();return 0;}则该程序运行后的输出结果是【 】。
若有以下程序:include using namespace std;class Base{public: void who(){cout<<" B
若有以下程序:
include <iostream>
using namespace std;
class Base
{
public:
void who(){cout<<" Base"<<end1:}
};
class Derived1: public Base
{
public:
void who(){ cout<<"Derived"<<end1;}
};
int main()
{
Base *p;
Derived1 obj1;
p=&obj1;
p->who();
return 0;
}
则该程序运行后的输出结果是【 】。
相关考题:
有如下程序:includeusing namespace std;Class Base{public:Base(){cout 有如下程序: #include<iostream.h> using namespace std; Class Base { public: Base(){cout<<“BB”;f();} void{(){cout<<“BF”;} }; class Derived:public Base { public: Derived(){cout<<“DD”;} void f(){cout<<“Df”;) }; int mainA.BBBfDDB.BBDfDDDfC.DDD.DDBBBf
若有以下程序:include using namespace std;class Base{public: Base ( ) {x=0; } in 若有以下程序: #include <iostream> using namespace std; class Base { public: Base ( ) { x=0; } int x; }; class Derivedl : virtual public Base { public: Derivedl () { x=10; } }; class Derived2 : virtual public Base { public: Derived2 () { x=20; } }; class Derived : public Derivedl,protected Derived2{ }; int main ( ) { Derived obj; cout<<obj .x<<end1; return 0; } 该程序运行后的输出结果是 ( )。A.20B.30C.10D.0
有如下程序: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
有如下程序: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
下列程序的运行结果是______。include class Base { public: void f(int x){cout 下列程序的运行结果是______。include<iostream.h>class Base{public:void f(int x){cout<<“Base:”<<x<<endl;});class Derived:public Base{public:void f(char*str){cout<<“Derived:”<<str<<endl;}};void main(void){Base*pd=ne
若有以下程序: include using namespace std; class Base { public:void who(){ cout 若有以下程序:include <iostream>using namespace std;class Base{public:void who(){cout<<"class Base"<<end1;}};class Derivedl : public Base{public:void who(){cout<<"class Derivedl"<<end1;}};class Derived2 : public Base{public:void who(){cout<<"class Derived2"<<end1;}};int main(){Base *p;Derivedl obj1;Derived2 obi2;p=obj 1;p=obj2;p->who ( );return 0;}则该程序运行后的输出结果是【 】。
有以下程序:includeusing namespace std;class BASE{private: char c;public: BASE(c 有以下程序: #include <iostream> using namespace std; class BASE { private: char c; public: BASE(char n):c(n);{} virtual~BASE() { cout<<c; } }; class DERIVED:public BASE { char c; pA.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 TestClass{public:void who(){cout 若有以下程序: #include<iostream> using namespace std; class TestClass { public: void who(){cout<<"TestClass"<<endl;} }; class TestClass1:public TestClass { public: void who(){cout<<"TestClass1"<<endl;} }; int main() { TestClass *p; TestClass1 obj1; P=obj1; P->who(); return 0; 则该程序运行后的输出结果是( )。A.TestClass1B.TestClassC.0D.无输出