why assignment operator not inherited in derived class in c++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abu bakar sandhu
    New Member
    • Sep 2010
    • 1

    #1

    why assignment operator not inherited in derived class in c++

    why assignment operator operatoerdoes not inherited in c++
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    It is one of those methods that has some strangeness, like the constructors and destructor.

    Inheriting the assignment operator would not serve any particularly useful purpose in the most likely case that the derived class has data of its own since the derived class data would not be copied resulting in a assignment operator that does not do a full copy.

    The default assignment operator provided by the compiler calls the assignment operators of any base classes of the current class as part of its operation.

    Comment

    Working...