B
bytebro
I normally use something like this for an assignment operator when
class Thing has a smart pointer p_ to private implementation data:
Thing&
Thing:
perator=(const Thing& rhs)
{
if (this != &rhs)
{
Thing temp(rhs);
swap(p_, temp.p_);
}
return *this;
}
My problem is that this fails to compile is any member functions in
Thing are pure.
thing.cc: In member function 'Thing& Thing:
perator=(const Thing&)':
thing.cc:56: error: cannot declare variable 'temp' to be of abstract
type 'Thing'
Is there some standard way around this?
class Thing has a smart pointer p_ to private implementation data:
Thing&
Thing:
{
if (this != &rhs)
{
Thing temp(rhs);
swap(p_, temp.p_);
}
return *this;
}
My problem is that this fails to compile is any member functions in
Thing are pure.
thing.cc: In member function 'Thing& Thing:
thing.cc:56: error: cannot declare variable 'temp' to be of abstract
type 'Thing'
Is there some standard way around this?