The assignment operator could not be generated even when the operator overloaded =

My class is polymorphic and should not be used in any way. It has an element that is of type Font & and as a result, the compiler cannot generate the an = operator. So I just created dummy implementations of the destination and copy constructor, put them in a private class, but it still warns me that the assignment operator cannot get the generated one. How else can I get rid of this warning?

thank

Warning 9 warning C4512: "AguiWidget": an assignment statement cannot be generated c: \ users \ josh \ documents \ visual studio 2008 \ projects \ agui \ alleg_5 \ agui \ aguiwidget.hpp 250

+5
source share
3 answers

The assignment operator that the compiler is warning you about is the one that was created for your own class. Now you have:

AguiWidget& operator=(const AguiFont &tmp);

What you need:

AguiWidget& operator=(const AguiWidget &tmp);
+9
source

You can disable it. Of course, this will not work if you are actually trying to use these operators.

Are you sure you have signatures? Did you make them for each class, base and derivatives?

+3
source

boost:: noncopyable.

class AGUI_CORE_DECLSPEC AguiWidget : private boost::noncopyable

:

boost:: noncopyable .

EDIT:

... ...

pimpl idiom, .

You should also try to avoid protected member variables (as much as possible) as it interrupts encapsulation.

+2
source

All Articles