I am having trouble learning the correct syntax for when an object of a derived class tries to call the constructor of the base class. For example, say I have a header file that includes the declarations for a base class and derived class.
The constructor for the base class:
Base(const string& name, const int& age)
The constructor for the derived class:
Derived(const int& height, const int& weight)
In the Base class, we have private member variables TheName (initialized by the constructor through name) and TheAge (initialized by the constructor through age). In the Derived class, the private variables are TheHeight and TheWeight which are initialized through height and weight respectively.
In the implementation file for the base class, I know that the definition for the constructor will look like this:
Base:Base(const string& name, const int& age): TheName(name), TheAge(age)
How would the syntax for the constructor of the Derived class look like when declaring it in the header and defining it in the implementation file?
Also, in an application file, how would I make an object of the Derived class? All I do know is that making an object of the Base class would look like this: