有以下程序 #include<iostream> using namespace std; class Complex { public: Complex(double r=O,double i=0):re(r),im(i){} double real() const {return re;} double imag()const {return im;} Complex operator +(Complex C) const {return Complex (re+c.re,im+c.im);} private: double re,im; }; int main() { Complex a=Complex(1,1)+Complex (5); cout<<a.real()<<'+'<<a.imag()<<'i'<<endl; retum 0; } 程序执行后的输出结果是
A.6+6i
B.6+1i
C.1+6i
D.1+1i
[单选题]有以下程序:include using namespace std;class A{private:int a;public:A (int i){a有以下程序: #include <iostream> using namespace std; class A { private: int a; public: A (int i) { a=i; } void disp() { cout<<a<<","; } }; class B { private: int b; public: B(int
[单选题]有以下程序:include using namespace std;class sample {private: iht n;public: sam有以下程序: #include <iostream> using namespace std; class sample { private: iht n; public: sample(){} sample(int m) { n=m; } void addvalue(int m) { sample s; s.n=n+m; *this=s; } vo
[单选题]有以下程序include using namespace std;class MyClass{public:MyClass(int n) { num有以下程序#include <iostream>using namespace std;class MyClass{public: MyClass(int n) { number=n; } //拷贝的构造函数 MyClass(MyClass& other) {number=other. number; } ~MyClass() { }priv
[单选题]有以下程序: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 { publ
[单选题]有以下程序:include using namespace std;class sample{private:intn;public:sample(有以下程序:#include <iostream>using namespace std;class sample{private: int n;public: sample() {} sample(int m) { n=m; } sample add(sample s1,sample s2) { this->n-s1.n+s2.n; return
[单选题]有以下程序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
[单选题]有以下程序;include using namespace std;class R{public:R(int r1,int r2){R1=r1;R2有以下程序; #include <iostream> using namespace std; class R { public: R(int r1,int r2) { R1=r1; R2=r2; } void print(); void print () const; private: int R1, R2; }; void R::print ()
[单选题]有以下程序:include using namespace std;class sample{private:int n;public:sample有以下程序: #include <iostream> using namespace std; class sample { private: int n; public: sample(){} sample(int m) { n=m; } void addvalue(int m) { sample s; s.n=n+m; *this=s; } vo
[单选题]有以下程序include using namespace std;class MyClass{public: MyClass(int n) { nu有以下程序 #include <iostream> using namespace std; class MyClass { public: MyClass(int n) { number=n; } // 拷贝构造函数 MyClass(MyClass& other) {number=other. number;} -MyClass() {}
[单选题]有以下程序:include using namespace std;class sample{private: int n;public: samp有以下程序: #include <iostream> using namespace std; class sample { private: int n; public: sample(){} sample (int m) { n=m; } sample add(sample s1,sample s2) { this->n=s1.n+s2.n; r