标题:请教一个拷贝构造函数
取消只看楼主
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



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-347919-1-1.html




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

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