| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 741 人关注过本帖
标题:请教一个拷贝构造函数
取消只看楼主 加入收藏
qong
Rank: 2
等 级:论坛游民
帖 子:9
专家分:11
注 册:2011-8-2
结帖率:50%
收藏
 问题点数:0 回复次数:0 
请教一个拷贝构造函数
程序代码:
#include <iostream>

using std::cout;
using std::cin;
using std::endl;

class Remo {
    public:
        Remo(int xx,int yy) {
            x=xx;
            y=yy;
        }
        Remo(const Remo& temp);
        int GetX() {
            return x;
        }
        int GetY() {
            return y;
        }
    private:
        int x;
        int y;
};

int main() {
    int x,y;
    Remo frist(1,2);
    Remo second=frist;
    x=second.GetX();
    y=second.GetY();
    cout << x << endl;
    cout << y << endl;
    return 0;
}                    /*不知道为什么会出错,编译的时候通过了,链接的时候怎么都通不过*/
        
2011-08-19 08:54
快速回复:请教一个拷贝构造函数
数据加载中...
 
   



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

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