69,382
社区成员
发帖
与我相关
我的任务
分享
struct big
{
int bit[50];
struct big operator + (struct big right);
struct big operator=(struct big right);
};
struct big
{
int bit[50];
struct& big operator + (const struct& big right);
struct& big operator=(const struct& big right);
};
class big
{
public:
big operator +(const big & rhs);
big & operator =(const big &rhs);
private:
int m_bit[50];
};
big big::operator +(const big & rhs)
{
big ret;
for (int i=0; i<50; i++)
{
ret.m_bit[i] = m_bit[i] + rhs.m_bit[i];
}
return ret;
}
big & big::operator =(const big &rhs)
{
for (int i=0; i<50; i++)
{
m_bit[i] = rhs.m_bit[i];
}
return *this;
}