有如下程序:#include <iostream>using namespace std;class point{ int x, y;public: point( int vx, int vy ) { x = vx; y = vy; } point ( ) x = 0; y= 0; } point operator+( point p1 ) { point p; int px = x+ p1.x; int py = y + p1.y; return point( px, py ); point operator-( point p1 ) { point p; int px = x -p1.x; int py = y - p1.y; return point ( px, py ); } void print() { cout<<x<<" , "<<y<<end1; }};int main (){ point p1(10, 10 ), p2( 20, 20 ); p1 = p1 - p2; p1.print (); return 0;} 执行后的输出结果是
A.10,10
B.20,20
C.10,20
D.30,30
[单选题]有如下程序:include using namespace std;Class x{protected: int a;public: x() {a=有如下程序: #include <iostream> using namespace std; Class x { protected: int a; public: x() { a=1; } }; class x1 : virtual public x { public: x1() { a+=1; cout<<A.1B.123C.242D.244
[单选题]有如下程序:include using namespace std;class AA{public: virtual void f() {cout<有如下程序: #include <iostream> using namespace std; class AA { public: virtual void f() { cout<< "AA"; } }; class BB : public AA { public: BB() { cout << "BB"; } }; claA.AAB.AA
[单选题]有如下程序:include using namespace std;class point{intx,y;public:point( int vx,有如下程序:#include <iostream>using namespace std;class point{ int x, y;public: point( int vx, int vy ) { x = vx; y = vy; } point ( ) x = 0; y= 0; } point operator+( point p1 ) { po
[单选题]有如下程序include using namespace std;class base{public:virtual void f1(){cout<有如下程序#include <iostream>using namespace std;class base{public: virtual void f1() { cout<<"F1Base "; } virtual void f2() { cout<<"F2Base "; }};class derive: public base{ voi
[单选题]有如下程序:include using namespace std;class Base{private:charc;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 A {public: A() {cout<<"A";}};class有如下程序: #include <iostream> using namespace std; class A { public: A() {cout<<"A";} }; class B {public:B() {cout<<"B";}}; class C: public A { Bb; public: C() {cout<<"C";
[单选题]有如下程序:include using namespace std;class Stack {public: Stack(unsigned n= 1有如下程序: #include <iostream> using namespace std; class Stack { public: Stack(unsigned n= 10):size(n) {rep_=ew int[size]; top=0;} Stack(Stack& s):size(s.size) { rep_=new int[
[单选题]有如下程序:include using namespace std;class x{protected: int a;public: x() { a有如下程序: #include <iostream> using namespace std; class x { protected: int a; public: x() { a=1; } }; class x1 : virtual public x { public: x1() { a+=1; cout<<a; } };A.1B.123C.24
[单选题]有如下程序:include using namespace std;class BASE{public:~BASE(){cout<<"BASE";}有如下程序: #include <iostream> using namespace std; class BASE{ public: ~BASE(){cout<<"BASE";} }; class DERIVED:public BASE{ public: ~DERIVED(){cout<<"DERIVED";} }; int main(
[单选题]有如下程序:include using namespace std;class Base{public:Base(){ cout<<"BB";有如下程序: #include <iostream.h> using namespace std; class Base { public: Base(){ cout<<"BB"; f(); } voidf(){cout <<"Bf"; } }; class Derived: public Base { public: Derived (){c
[单选题]有如下程序:include using namespace std;class A{public:A( ){cout<<"A";}~A( ){cou有如下程序: #include <lostream> using namespace std; class A{ public: A( ){cout<<"A";} ~A( ){cout<<"~A";} }; class B:public A{ A*P; public: B( ){cout<<"B";P=new A( );} ~B( )