Question: #include #include #include using namespace std; class Family { public: string name; int age; Family * spouse; vector * kids; / * * * Create

#include
#include
#include
using namespace std;
class Family{
public:
string name;
int age;
Family * spouse;
vector* kids;
/**
* Create a constructor that takes 4 arguments
* @param n takes default 'unknown'
* @param a takes default 18
* @param s takes default NULL
* @param v takes default NULL
*/
Family( string n="Unknown", int a=18, Family * s=NULL,vector * v=NULL){
name=n;
age=a;
kids=new vector; // Heap allocated
spouse=s;
}
/**5pts
* Create a destructer, set the data fields to default values
* and delete the heap allocated data
*/
/**15pts
* Create a copy constructor,
* @param const Family object passed by reference
* promote the user to choose: 1 for shallow copy else for deep copy
* shallow copy: assigns the copied object's fields to this data fields
* Deep copy : same as shallow except with heap allocated fields, it allocates
* new allocation and copy the value of the passed in pointer to it.
*/
solve in C++

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!