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 arguments
@param n takes default 'unknown'
@param a takes default
@param s takes default NULL
@param v takes default NULL
Family string n"Unknown", int a Family sNULL,vector vNULL
namen;
agea;
kidsnew vector; Heap allocated
spouses;
pts
Create a destructer, set the data fields to default values
and delete the heap allocated data
pts
Create a copy constructor,
@param const Family object passed by reference
promote the user to choose: 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
