Question: Base.h / cpp Create a Base class. Add a private char * member to the class for the name and initialize it to nullptr. Next,

Base.h/cpp
Create a Base class. Add a private char* member to the class for the name and initialize it to nullptr. Next, implement a public SetName method (it must do a deep copy of the memory since the name is a dynamic pointer). You may use the CopyString method from lecture. Also add a public GetName() method that will return the name.
Declare a public DisplayRecord method that is pure virtual (meaning it will have no definition):
virtual void DisplayRecord()=0;
Finally, fully implement the Rule of 3 for the class because it has a dynamic memory member.
HINT: You only need to write the operator= and just have your copy constructor call that method (*this = copy;) since they will usually have the same code.
Because the rule of 3 incorporates a copy constructor, you will lose the blank default constructor that Visual Studio writes for you. Add an empty default constructor to the class to fix this.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!