#include "stdafx.h"
typedef struct A{ A(){}
A(const A& another) { a = another.a; b = another.b; c = another.c; d = another.d; }
A operator= (const A& another) { a = another.a; b = another.b; c = another.c; d = another.d; return (*this); }
int a; double b; int c; double d;} AAA;
int _tmain(int argc, _TCHAR* argv[]){ AAA first;
first.a = -3; first.b = -2.5; first.c = -2; first.d = -1.5;
AAA second(first);
second = first;
return 0;}
通过打断点,可以看出 直接用引用 和用“=”赋值的不同。