So im making a somewhat bigger project for a assignment in school and i'm wondering how i should go about and construct my assignment operator. Iv got 2 classes that inherit from another one and in the base class i make an array to hold 3 strings.
This is how my code snip looks like atm, what i'm wondering tho is if i need to copy the array as well in order for it to work properly and in that case how?
What array? Show us your class definition. From the look of your assigment operator, if all types are non-pointer, you could leave default generated one.
@ OP: You realize that you have an array of pointers, and not a pointer to an array right? That was a mistake that I used to make far too often. How are you initializing those private data members if you don't mind me asking? There is a potential for an certain error here that would be easy to overlook.
Your right, the array is meant to have a fixed size so its better to have " Sport sports[sportsSize];" but now i need to implement the operator= as well.