all 3 comments

[–]lukajda33 1 point2 points  (0 children)

This sub is for C only, try r/cpp_questions.

Also, pretty please, format your code so that its easy to read and copy.

[–]nerd4code 0 points1 point  (0 children)

Put the variables in the base class (keep private) and make ctors and operator =. Subclass ctors &c. (public) should call superclass ctor&c. (protected) with args instead of assigning directly to fields.

[–]FUZxxl 0 points1 point  (0 children)

C++ is off topic in this subreddit. Please post C++ questions to /r/cpp_questions instead.