0

I have a general question i C++ that I coudln't get a clear answer to and I'm hoping I get an answer to it here. As a programmer, do I need to explicitly overload the assignment operator for a class when all instance data fields in this class are standard built in C++ data types.

Ash
  • 61
  • 5
  • Someone might explain you the full details in an answer; but if a class only consists of primitive types, the default assignment operator will suffice. – Maarten Bamelis May 05 '15 at 15:43

2 Answers2

0

No. You only need to overload the defaults if you are doing manual resource management. If all of your members can be treated as POD types then you will be fine.

Community
  • 1
  • 1
NathanOliver
  • 171,901
  • 28
  • 288
  • 402
-1

No, you don't.​​​​​​​​​​​​​​​​​​​​​

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055