拷贝构造函数。=运算符。
HIGE6 2008-12-03 11:36:08 #include "stdafx.h"
class Point
{
public:
Point(){};
Point(double x, double y):m_x(x),m_y(y){}
Point(const Point& p);
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);
}
这个时候没有调用拷贝构造函数。
需要重载=运算符?该如果做?