Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Assignment operator could not be generated even when I overload the = operator

My class is polymorphic and should not be used to be ='d anyways. It has a member which is of type Font& and as a result the compiler cannot generate an = operator. So I just created dummy implementations of the assignment and copy constructor, put them in the private of the class, but it still warns me about assignment operator not able to get generated. How else can I get rid of this warning?

Thanks

Warning 9 warning C4512: 'AguiWidget' : assignment operator could not be generated c:\users\josh\documents\visual studio 2008\projects\agui\alleg_5\agui\aguiwidget.hpp 250

like image 772
jmasterx Avatar asked Nov 24 '10 18:11

jmasterx


1 Answers

The assignment operator that the compiler is warning you about is the one for your own class. What you have now is:

AguiWidget& operator=(const AguiFont &tmp);

What you need is:

AguiWidget& operator=(const AguiWidget &tmp);
like image 190
casablanca Avatar answered Oct 02 '22 18:10

casablanca