Implementing copy and assignment
Expr::Expr(const Expr& e): p(e.p)
{
++p->use;
}
Expr& Expr::operator=(const Expr& e)
{
++e.p->use;
if (--p->use == 0)
delete p;
p = e.p;
return *this;
}
Previous slide
Next slide
Back to first slide
View graphic version