为驳回编译器自动(暗自)提供的机能,可将相应的成员函数声明为private并且不予实现。使用像Uncopyable这样的base class也是一种做法。
class
Uncopyable
{
protected :
Uncopyable(){}
~ Uncopyable(){}
private :
Uncopyable( const Uncopyable & );
Uncopyable & operator = ( const Uncopyable & );
};
{
protected :
Uncopyable(){}
~ Uncopyable(){}
private :
Uncopyable( const Uncopyable & );
Uncopyable & operator = ( const Uncopyable & );
};