16,467
社区成员
发帖
与我相关
我的任务
分享
class CCOP
{
public:
int a;
double b;
char c[4];
public:
CCOP()
{
a = 0;
b = 0;
memset(c, 0, sizeof(c));
}
CCOP(CCOP &other)
{
operator = (other);
}
public:
void operator = (CCOP &other)
{
a = other.a;
b = other.b;
memcpy(c, other.c, sizeof(c));
}
};
//测试代码
CCOP tm1;
tm1.b = 2.0;
CCOP tm2 = tm1;
ASSERT(tm2.b == 2.0);