This question already has an answer here:
As c++ standard says,
copy assignment is implicitly declared if not declared by user,
If this is the case, when we declare two class one is base and one child , then for both class "copy assignment" is declared. So if its true then
when
Base b;
child c;
b = c // success (but according to me it should failed)
c = b // error
(why its failure , as c is inheriting b , then it should have both assignment operator overloaded function). many place its explained like animal and dog example , buts not the technical prospective view.
Aucun commentaire:
Enregistrer un commentaire