有如下的程序; #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.系统不能生成缺省的拷贝构造函数
[单选题]有如下程序 include include using namespace std; int main(有如下程序 #include<iostream> #include<iomanip> using namespace std; int main(){ cout<<setprecision(3)<<fixed<<setfill('*')<<setw(8); cout<<12.345<<_______<<34.567; return 0; } 若程序的输出是: ** 12.345**34.5
[单选题]有如下程序:include include using namespace std;class CSum{int x,y有如下程序: #include <iostream.h> #include <iomanip.h> using namespace std; class CSum { int x,y; public: CSum (int x0,int y0):x(x0),y(y0){} friend ostream & operator<<(ostream& os,const
[单选题]有如下程序: include include using namespace std; int main(){ cout<
[单选题]有如下程序:include include using namespace std;class CSum{int x,y;pub有如下程序: #include <iostream> #include <iomanip> using namespace std; class CSum {int x,y; public: CSum(int x0,int y0):x(x0),y(y0) {} friend ostream& operator<<(ostream & os, const
[单选题]有如下的程序: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; };
[单选题]有如下程序include include using namespace std;class MyClass {public:M有如下程序#include <iostream>#include <iomanip>using namespace std; class MyClass {public:MyClass(){ cout<<'A'; }MyClass(char c){ cout<<c; }~MyClass(){ cout<<'B'; }};int main() {MyClass p
[单选题]有如下程序include include using namespace std;int main( ){cout<
[单选题]有如下程序:include using namespace std;using namespace std;class Base{public:vo有如下程序: #include <iostream> using namespace std; using namespace std; class Base{ public: void fun( ){cout<<"Base::fun"<<endl:} }; class Derived:public Base{ public: void fun(
[单选题]有如下程序: #include(iostream) using namespace std; class TestClass{ protected: TestClass(){couti(cout<<‘x’;} TestClass(char c){cout<<c;}}; class TestClassl:publicTestClass{ public: TestClassl(char c){cout<<c;}}; int main(){ TeA.yB.yxC.xyD.yy
[单选题]有如下程序: qnclude include using namespace std;有如下程序: #qnclude<iostream> #include<iomanip> using namespace std; class CSum { int x,y; public: CSum(int x0,int y0):x(xo),y(yo){} friend ostream& operator<<(ostream&os,const CSum&xa) { os<<setw(5)