When an ABC defines an assignment operator merely to make it protected:. When a protected: assignment operator contains the same code that the compiler would have synthesized automatically, its only purpose is to prevent users from assigning to an object of the class. This is common with abstract base classes. Here's an example. class Position { }; class Shape { public: virtual void draw() const throw() = 0; virtual ~Shape() throw(); protected: Position pos_; void operator= (const Shape& s) throw(); }; inline void Shape::operator= (const Shape& s) throw() { pos_ = s.pos_; } Shape::~Shape() throw() { } Note that such an assignment operator does not automatically trigger the Law of the Big Three (see FAQ 30.13). |