[ell-i-developers] Register Assignment Operator (operator = )

  • From: Ivan Raul <supra.material@xxxxxxxxx>
  • To: "ell-i-developers@xxxxxxxxxxxxx" <ell-i-developers@xxxxxxxxxxxxx>
  • Date: Tue, 19 Aug 2014 17:46:35 +0200

Dear All,

I remember we had a brief discussion about why it is necessary to
define the assignment operator in every class that inherits Register

https://github.com/Ell-i/Runtime/blob/master/stm32/emulator/inc/Register.h#L56

Why it does not behave as the other inherited operators?

I think this is quite related:

http://www.learncpp.com/cpp-tutorial/911-the-copy-constructor-and-overloading-the-assignment-operator/


*//----*

*Default memberwise copying*

Just like other constructors, C++ will provide a *default copy constructor*
if you do not provide one yourself. However, unlike other operators, C++
will provide a *default assignment operator * if you do not provide one
yourself!


//----

Is there any cleaner way to inherit the operator, and just overload it if
necessary?

With Warm Regards, Ivan Raul

Other related posts: