一道c++题 求解析

下面程序的运行结果是______。
#include
class Point
{ public:
Point ( int a, int b )
{ x=a ; y=b ; cout << "Constructor Called." << endl ; }
Point ( const Point &p ) ;
~Point( )
{ cout << "Destructor Called.\n" ; }
int xcord( ) { return x ; }
int ycord( ) { return y ; }
private:
int x , y ;
};
Point :: Point ( const Point &p )
{ x=p.x ; y=p.y ; cout << "Copy_initialization Constructor Called.\n" ; }
Point move ( Point q )
{ cout << "ok\n" ;
int a , b ; a=q.xcord() 10 ; b=q.ycord() 20 ;
Point p ( a , b ) ; return p ; }
void main( )
{ Point m( 15 , 40 ) , p( 0 , 0 ) ;
Point n( m ) ;
p = move( n ) ;
cout << "p=" << p.xcord() << "," << p.ycord() << endl ;
} #C语言编程题#  #题解#
全部评论

相关推荐

03-23 21:23
东南大学 Java
这虾皮笔试是人能出出来的呀?真的人才,真红温了,三题都会做,结果一个层序遍历的返回值用数组???又不能改返回值,改了就执行错误????用数组就会有默认0,直接过不了
Makabaka_307:沙雕虾皮ide,我在线上ide跑完测试样例,在那个调试页面有个提交答案。我点完就直接交卷了。
投递虾皮信息等公司10个岗位 >
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务