| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 584 人关注过本帖
标题:求助编译出错怎么回事??坐等
只看楼主 加入收藏
zhaoya881010
Rank: 9Rank: 9Rank: 9
来 自:芒砀古郡
等 级:蜘蛛侠
威 望:1
帖 子:339
专家分:1177
注 册:2010-11-21
结帖率:57.14%
收藏
已结贴  问题点数:10 回复次数:3 
求助编译出错怎么回事??坐等
程序:
程序代码:
#include <iostream>

using namespace std;


class Point
{
   public:
      Point(int xx=0, int yy=0)   {X=xx; Y=yy; cout<<"The construct fun called"<<endl;}
      Point(Point& p);
  //    Point(Point p);
      int GetX()   {return X;}
      int GetY()   {return Y;}

 //     Point& test(Point& a);
   private:
      int X, Y;
};


Point::Point(Point& p)
{
    X=p.X;
    Y=p.Y;
    cout<<"The copy construct fun called 11111"<<endl;
}

/*
Point::Point(Point p)
{
    X=p.X;
    Y=p.Y;
    cout<<"The copy construct fun called 22222"<<endl;
}
*/


Point test(Point a)
{
       cout<<"test"<<endl;
    return a;
}



int main(int argc , char** argv)
{
    Point box1(2, 2);
    cout<<"first"<<endl;
    Point box2=box1;
    cout<<"second"<<endl;
    Point box3(box1);
    cout<<"third"<<endl;
    Point box4;
    cout<<"forth"<<endl;

    box4=box1;
      
    cout<<"fifth"<<endl;
    test(box3);
    box2=test(box3);//出错!
    Point box5=test(box3);//出错!
    return 0;
}

搜索更多相关主题的帖子: Point 
2010-12-29 16:04
qq1023569223
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
来 自:湖南科技大学
等 级:贵宾
威 望:26
帖 子:2753
专家分:13404
注 册:2010-12-22
收藏
得分:0 
不懂

   唯实惟新 至诚致志
2010-12-29 16:35
ytchfp
Rank: 1
等 级:新手上路
帖 子:5
专家分:5
注 册:2010-11-30
收藏
得分:5 
没有错,可能是你装的版本有问题。
2010-12-30 10:15
shafeilong
Rank: 9Rank: 9Rank: 9
等 级:蜘蛛侠
威 望:4
帖 子:236
专家分:1434
注 册:2009-3-21
收藏
得分:5 
我这里运行的好好的
2010-12-30 13:13
快速回复:求助编译出错怎么回事??坐等
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017753 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved