网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
( 33 )下面程序中对一维坐标点类 Point 进行运算符重载
#include
using namespace std;
class point {
public:
point ( int vaI ) {x=val;}
point & operator++ () {x++;retum*this;}
print operator++ ( int ) {point ld=*this,++ ( *this ) ;retum old;}
int GetX () const {retum x;}
private:
int x;
};
int main ()
{
point a ( 10 ) ;
cout<< ( ++a ) .GetX () ;
cout<<A++.GETX () ;
retum () ;
}
编译和运行情况是
A )运行时输出 1011
B )运行时输出 1111
C )运行时输出 1112
D )编译有错
参考答案
更多 “ ( 33 )下面程序中对一维坐标点类 Point 进行运算符重载#includeusing namespace std;class point {public:point ( int vaI ) {x=val;}point & operator++ () {x++;retum*this;}print operator++ ( int ) {point ld=*this,++ ( *this ) ;retum old;}int GetX () const {retum x;}private:int x;};int main (){point a ( 10 ) ;cout ( ++a ) .GetX () ;coutA++.GETX () ;retum () ;}编译和运行情况是A )运行时输出 1011B )运行时输出 1111C )运行时输出 1112D )编译有错 ” 相关考题
考题
下面程序中对一维坐标点类Point进行运算符重载 include using namespace std;
下面程序中对一维坐标点类Point进行运算符重载 #include <iostream> using namespace std; class Point { public: Point(int val) {x=val;} Point operator++() {x++; return *this; } Point operator++(int) {Point ld = *this; ++(*this); return old;} int GetX() const {return x;} private: int x; }; int main() { Point a(10); cout << (++a).GetX(); cout << a++.GetX(); return 0; }编译和运行情况是A.运行时输出1011B.运行时输出1111C.运行时输出1112D.编译有错
考题
若有语句int *point,a=4;和 point=a;,下面均代表地址的一组选项是A.a,point,*a B.和 point=a;,下面均代表地址的一组选项是A.a,point,*a B.*a,a,*point C.*point,*point,a D.a,*point,point
考题
若有语句int * point,a=4;和point=a;下面均代表地址的一组选项是()。A.a,point,*aB.a;下面均代表地址的一组选项是( )。A.a,point,*aB.*a,a,*pointC.*point,*point,aD.a, * point,point
考题
若有语句int*point,a=4;和point=a;下面均代表地址的一组选项是 A.a,point,*和 point=a;下面均代表地址的一组选项是A.a,point,*aB.*a,a,*pointC.*point,*point,aD.a,*point,point
考题
若有语句int *point, a=4; point=a; 下面均代表地址的一组选项是A.point, *aB.*a, a, *pointC.*point, *point, aD.a, *point , point
考题
下列哪个关于加号“+”运算符重载的成员函数声明格式是正确的。A.POINT operator+(POINT b);B.POINT +(POINT b);C.POINT operator+();D.POINT +(int);E.POINT operator +(POINT a, POINT b);
考题
Point为一个类,下面的友元运算符重载函数原型中,正确的是()A.friend float operator + (float);B.friend Point operator + (float x, float y);C.friend Point operator + (float, float);D.friend Point operator + (Point, float);
考题
若有语句 int *point, a = 4; point = a; 下面均代表地址的一组选项是()A.point,*aB.*a,a, *pointC.*point, *point, aD.a, *point,point
考题
若有语句 int *point, a = 4; point = a; 下面均代表地址的一组选项是()。A.point,*aB.*a,a, *pointC.*point, *point, aD.a, *point,point
热门标签
最新试卷