64,682
社区成员
发帖
与我相关
我的任务
分享
#include "stdafx.h"
class Pixl
{
public:
Pixl(){};
private:
int m_x;
int m_y;
};
class Point
{
public:
Point(){};
Point(double x, double y):m_x(x),m_y(y){}
Point(const Point& p);
Point& operator=(const Point &src);
private:
double m_x, m_y;
Pixl &pixl;
};
Point& Point::operator=(const Point &src)
{
if(this != &src)
{
m_x=9;
m_y=src.m_y;
}
return *this;
}
Point::Point(const Point& p)
{
m_x=p.m_x;
m_y=p.m_y;
}
void main()
{
Point p2 ;
Point p3 = Point(3,5);
p2 = p3;
}
class Point
{
public:
Point(){};
Point(double x, double y):m_x(x),m_y(y){}
Point(const Point& p);
Point& operator=(const Point& other) {
m_x = other.m_x;
m_y = other.m_y;
return *this;
}
private:
double m_x, m_y;
};
Point::Point(const Point& p)
{
m_x=9;
m_y=p.m_y;
}
void main()
{
Point p2 ;
p2 = Point(3,5);
}