利用类的初始化列表来复制即可,看下面代码
class base
{
public:
base();
base(const base& other)
{
//...
}
};
class node : public base
{
node();
node(const node& other):base(other)
{
//...
}
node& operator=(node& other):base(other)
{
//...
return *this;
}
};
原文:http://www.cnblogs.com/JensenCat/p/5167798.html