有如下的程序: #include<cstring.h) #ingclude<iostream.h) using namespace std; Class MyString {public: MyString(const char*s); ~MyString(){delete[]data;} protected: unsigned len; char*data;}; MyString::MyString(const char*S) {lA.构造函数的实参不允许是本类的对象B.没有定义实现深层复制(深拷贝)的复制构造函数C.构造对象a时实参与形参类型不符D.系统不能生成默认的复制构造函数

有如下的程序: #include<cstring.h) #ingclude<iostream.h) using namespace std; Class MyString {public: MyString(const char*s); ~MyString(){delete[]data;} protected: unsigned len; char*data;}; MyString::MyString(const char*S) {l

A.构造函数的实参不允许是本类的对象

B.没有定义实现深层复制(深拷贝)的复制构造函数

C.构造对象a时实参与形参类型不符

D.系统不能生成默认的复制构造函数


相关考题:

下列程序的输出结果是______。 include include using namespace std; voi 下列程序的输出结果是______。include<iostream.h>include<string.h>using namespace std;void fun(const char*s,char C) {c=s[strlen(s)/2];}int main(){char str[]="ABCDE";char ch=str[1];fun(str,ch);cout<<ch;return 0;}

有如下程序 include using namespace std; class Base { protected: 有如下程序 #include <iostream> using namespace std; class Base { protected: Base( ){cout<<'A'; } Base(char c) { cout<<c; } }; class Derived: public Base { public: Derived(char c){ cout<<c; } }; int main( ){ Derived d1 ('B'); return 0; } 执行这个程序屏幕上将显示输出A.BB.BAC.ABD.BB

有如下程序: include using namespaee std;class Animal{ public: virtual char*g 有如下程序:include<iostream>using namespaee std;c lass Animal{public:virtual char*getType( )const{return"Animal";}virtual char*getVoice( )const{return"Voice";}};class Dog:public Animal{public:char*getType( )const{return"Dog";}char*getVoice( )eonst{return"Woof";}};void type(AnimalA) {cout<<a.getType( );}void speak(Animal A) {eout<<a.getVoice( );}int main( ){Dog d;type(D) ;cout<<"speak";speak(D) ;cout return 0;}程序的输出结果是______。

有如下程序: include using namespace std; class Monitor{ public: Monitor(cha 有如下程序:include<iostream>using namespace std;class Monitor{public:Monitor(char t):type(t){ }void Print( )const{cout<<"The type of monitor is"<<type private:char type;};class Computer{public:Computer(int i,char C) :______{}void Print( )const{eout<<"The computer is"<<id<<endl;mort.Print( );}private:int id;Monitor mon;};int main( ){const Computer myComputer(101,'B');myComputer.Print( );return 0;}请将程序补充完整,使程序在运行时输出:The computer is 101The type of monitor is B

有如下程序:includeusing namespace std;class Con{char ID;public:Con():ID('A'){co 有如下程序: #include<iostream> using namespace std; class Con { char ID; public: Con():ID('A'){cout<<1;} Con(char ID):ID(ID'){cout<<2;} Con(Conc):ID(c.getID()){cout<<3;} char getID()const{returnID;} }; void show(Con c){toA.13A23AB.23A13BC.13A23BD.13B23A

下列语句中,正确的是( )。A.char*myString="Hello-World!";B.char myString="Hello-World!";C.char myString[11]="Hello-World!";D.char myString[12]="Hello-World!";

有如下的程序: include include using namespace st 有如下的程序: #include<cstring> #include<iostream> using namespace std; class MyString { public: MyString(const char*s); ~MyString(){delete[]data;} Protected: unsigned len; char*data; }; MyString::MyString(const char*s) { len=strlen(s); data=new char[len+1]; strcpy(data,s); } int main() { MyString a("C++Programing"); MyString b(a); return 0; } 在运行上面的程序时出错,出错的原因是A.构造函数的实参不允许是本类的对象B.没有定义实现深层复制(深拷贝)的拷贝构造函数C.构造对象a时实参与形参类型不符D.系统不能生成缺省的拷贝构造函数

( 13 )有如下程序:#include iostreamusing namespace std;class GrandChild{public:GrandChild(){ strcpy (name,"Unknown"); }const char * getName()const { return name; }virtual char * getAddress()const=0;private:char name[20];};class GrandSon : public GrandChild{public:GrandSon{char *name} {}Char * getAddress() const { return "Shanghai";}};int main(){GrandChild *gs=new GrandSon("Feifei");coutgs-getName()" 住在 "gs-getAddress()endl;delete gs;return 0;}运行时的输出结果是 【 13 】 。

如下程序的输出结果是______。 include using namespace std; class Pet{ char nam 如下程序的输出结果是______。include<iostream>using namespace std;class Pet{char name[10];public:Pet(char*nanle){strcpy(this->name,name);}const char*getName( )const{return name;}virtual void call( )eonst=0;};class Dog:public Pet{public:Dog(char*name):Pet(name){ }void call( )eonst{cout<<"汪汪叫";}};class Cat:public Pet{public:Cat(char*name):Pet(name){ }void call( )const{eout<<"喵喵叫";}};int main( ){Pet*petl=new Dog("哈克"),*pet2=new Cat("吉米");eout<<petl->getName( );petl->call( );eout<<endl;cout<<pet2->getName( );pet2->call( );eout<<endl;return 0;}

有以下程序: include using namespace std; constxntN=5; int fun(char*s,char a,int 有以下程序:include <iostream>using namespace std;const xnt N=5;int fun(char *s,char a,int n){int j;*s=a;j=n;while(a<s[j])j--;return j;}int main(){char s[N+1];int k;

Const mystring=“hello”的含义是( )。A.在VBScript中,把变量mystring赋值为helloB.在VBScript中,把常量mystring的值定为helloC.在Java中,把变量mystring赋值为helloD.在Java中,把变量mystring赋值为hello

有如下的程序: #includestrin9.h #includeiostream.h usingnamespacestd; classMyString {public: MyString(constchar*s); MyString(){delete[]data;} protected: unsignedlem char*data;}; MyStrin9::MyString(constchar*s) {len=strlen(s); data=newchar[len+1]; strcpy(data,s);} intmain() {MyStringa("C++Programing"); MyStringb(a); return0;} 在运行上面的程序时出错,出错的原因是( )。A.构造函数的实参不允许是本类的对象B.没有定义实现深层复制的复制构造函数C.构造对象a时实参与形参类型不符D.系统不能生成默认的复制构造函数

有如下程序: #inCludeiostream using namespaCe std; Class Book{ publiC: Book(Char*t=””){strCpy(title,t);} private: Char titlel40]; }; Class Novel:publiC Book{ publiC: Novel(Char*t=””):Book(t){} Char*Category( )Const{return”文学”;} }; int main( ){ Book * pb; pb=new Novel( ); Coutpb→Category( ); delete pb; return 0; } 若程序运行时输出结果是“文学”,则横线处缺失的语句是( )。A.Char*Category( );B.Char*Category( )Const;C.virtual Char*Category( )Const;D.virtual Char*Category( )Const=0;

有如下程序:includeincludeusing namespace std;class MyString{public:My 有如下程序: #include<cstring> #include<iostream> using namespace std; class MyString{ public: MyString(const char * s); ~MyString( ){delete[ ]data;} protected: unsigned len; char * data; }; MyString::MyString(const char * s){ len=strlen(s); data=new char[1en+1]; strcpy(data,s); } int main( ){ MyString a("C++Progreanfing"); MyString b(A) ; return 0; } 在运行上面的程序时出错,错误的原因是A.构造函数的实参不允许是本类的对象B.没有定义实现深层复制(深复制)的复制构造函数C.构造对象a时实参与形参类型不符D.系统不能生成缺失的复制构造函数

有下列的程序: include include using namespace std; cl 有下列的程序: #include<cstring.h> #include<iostream.h> using namespace std; class MyString { public: MyString(const char*s); ~MyString(){delete[]data;} protected: unsigned len; char*data; }; MyString::MyString(const char*s) { len=strlen(s); data=new char[len+1); strcpy(data,s); } int main() { MyString a("C++Programing"); MyString b(a); return 0; } 在运行上面的程序时出错,出错的原因是( )。A.构造函数的实参不允许是本类的对象B.没有定义实现深层复制(深拷贝)的复制构造函数C.构造对象a时实参与形参类型不符D.系统不能生成默认的复制构造函数

有如下的程序:include include using namespace std;class MyString{p 有如下的程序: #include <cstring.h> #include <iostream.h> using namespace std; class MyString { public: MyString(const char*s); ~MyString () {delete [] data;} protected: unsigned len; char*data; }; MyString::MyString(const char *s) { len=strlen (s); data=new char[len+1]; strcpy (data,s); } int main () { MyString a("C++ Programing"); MyString b(a); return 0; } 在运行上面的程序时出错,出错的原因是A.构造函数的实参不允许是本类的对象B.没有定义实现深层复制(深拷贝)的复制构造函数C.构造对象a时实参与形参类型不符D.系统不能生成默认的复制构造函数

有如下程序: include using namespace std; class Pet{ char name[10]; public: Pet(c 有如下程序:include<iostream>using namespace std;class Pet{char name[10];public:Pet(char*name){strcpy(this->name,name);}const char*getName()const {return name;}virtual void call()const=0;};class Dog:public Pet{public:Dog(char*name):Pet(name){}void call()const{cout<<"汪汪叫":}};class Cat:public Pet{public:Cat(char*name):Pet(name){}void call()const{cout<<"喵喵叫";}};int main(){Pet*pet1=new Dog("哈克"),*pet2=new Cat("吉米");cout<<pet1->getName();pet1->call();cout<<end1;cout<<pet2->getName();pet2->call();cout<<end1;return 0;}程序的输出结果是______。

下列程序的输出结果是【】。 include include using namespace std; void fun(c 下列程序的输出结果是【 】。include<iostream>include<cstring>using namespace std;void fun(const char *s,char c){c=s[strlen(s)/2];}int main(){char str[]="ABCDE";char ch=str[1];fun(str,ch);cout<<ch;return 0;}

有如下程序:includeusing namespace std;class Publication{//出版物类char name[30] 有如下程序: #include<iostream> using namespace std; class Publication{//出版物类 char name[30]; public: Publication(char*name="未知名称"){strcpy(this->name,name);} const char*getName( )const{return name;} //常数据成员 virtual const char*getType( )const{return"未知类型";}//虚常数据成员 }; class Book:public Publication{ //书类 public: Book(char*name):Publication(name){ } virtual const char*getType( )const{return"书";} //虚常数据成员 }; void showPublication(Publication p){cout<<p.getType( )<<":"<<P.getName( )<<endl;} int main( ){ Book book("精彩人生"); showPublication(book); return 0; } 程序的输出结果是A.未知类型:未知名称B.未知类型:精彩人生C.书:未知名称D.书:精彩人生

下列程序的输出结果是______。includeinclude using namespace std;void 下列程序的输出结果是______。include <iostream.h>include <cstring.h>using namespace std;void fun(const char*s,char C) {c=s[strlen (s)/2];}int main {){char str [] ="ABCDE";char ch=str[1];fun(str,sh);cout<<Ch;return 0;}

有如下的程序:#includestrin9.h#includeiostream.husingnamespacestd;classMyString{public:MyString(constchar*s);MyString(){delete[]data;}protected:unsignedlemchar*data;};MyStrin9::MyString(constchar*s){len=strlen(s);data=newchar[len+1];strcpy(data,s);}intmain(){MyStringa(C++Programing);MyStringb(a);return0;}在运行上面的程序时出错,出错的原因是( )。A.构造函数的实参不允许是本类的对象B.没有定义实现深层复制的复制构造函数C.构造对象a时实参与形参类型不符D.系统不能生成默认的复制构造函数

有下列的程序:includeincludeusing namespace std;class MyString{pub 有下列的程序: #include<cstring.h> #include<iostream.h> using namespace std; class MyString { public: MyString(const char*s); ~MyString()<delete[]data;} protected: unsigned len; char*data; };A.构造函数的实参不允许是本类的对象B.没有定义实现深层复制(深拷贝)的复制构造函数C.构造对象a时实参与形参类型不符D.系统不能生成默认的复制构造函数

已知String类定义如下:class String{public:String(const char *str = NULL); // 通用构造函数String(const String another); // 拷贝构造函数~ String(); // 析构函数String perater =(const String rhs); // 赋值函数private:char *m_data; // 用于保存字符串};尝试写出类的成员函数实现。

已知类 String 的原型为class string{public:string(const char *str=null);//普通构造函数string(const string other);//拷贝构造函数---string(void);string operate=(const string other);//赋值函数private:char * m-data;//用于保存字符串};请编写 string 的上述4 个函数

下列语句中正确的是A.char*myString="Hello-World!";B.char myString="Hello-World!";C.char myString[11]=”Hello-World!”;D.char nlyString[12]="Hello-World!";

有如下的程序:include include using namespace std;class MyString{ 有如下的程序:#include <cstring.h>#include <iostream. h>using namespace std;class MyString{ public: MyString(const char*s); ~MyString() { delete[]data; } protected: unsigned len; char*data;};MyString::MyString(const char *s){ len=strlen(s); data=new char[len+ 1]; strcpy(data, s);}int main(){ MyString a("C++ Programing"); MyString b(a); return0;}在运行上面的程序时出错,出错的原因是( )。A.构造函数的实参不允许是本类的对象B.没有定义实现深层复制(深拷贝)的复制构造函数C.构造对象a时实参与形参类型不符D.系统不能生成默认的复制构造函数

有如下的程序;include include using namespace std;class MyString{public 有如下的程序; #include <ctring> #include <iostream> using namespace std; class MyString { public: MyString(const char *s); ~MyString() {delete[]data;} protected: unsigned len; char *data; }; MyString:: MyString (const char *s) { len=strlen(s); data=new char[len+1]; strcpy(data,s); } int main() { MyString a("C++ Programing"); MyString b(a); return 0; } 在运行上面的程序时出错,出错的原因是______ 。A.构造函数的实参不允许是本类的对象B.没有定义实现深层复制(深拷贝)的拷贝构造函数C.构造对象a时实参与形参类型不符D.系统不能生成缺省的拷贝构造函数