Question: 8 . 1 6 LAB: State ID renewal ( Copy assignment ) Given class StateID, overload the assignment operator ( in StateID.cpp ) so as

8.16 LAB: State ID renewal (Copy assignment)
Given class StateID, overload the assignment operator (in StateID.cpp) so as to allow a StateID object to be assigned to another StateID object.
StateID contains a pointer to an array of strings with length 5, which contains the state identification card's information. The information stored in the array should be in order of Name, State, Identification Number, Date of Birth, and Expiration Date.
In main.cpp, create a new StateID object as a backup of the old state ID (copy id to the new object). main.cpp then sets id's state, identification number, and expiration date to "Pennsylvania", "87654321", and "1/25/2028" respectively.
Print both the renewed and old state ID card's information using each ID's own print member function.
The output of main.cpp is:
Old ID: Name: John Doe State: Nebraska IDN: N01234567 DOB: 1/23/1980 EXP: 1/24/2023 New ID: Name: John Doe State: Pennsylvania IDN: 87654321 DOB: 1/23/1980 EXP: 1/25/2028
(StateID.h is a read only file, here is it below)
#ifndef STATEIDH
#define STATEIDH
#include
using namespace std;
class StateID {
private:
string *idInfo;
public:
StateID(){};
StateID(string *info);
void operator=(const StateID &id);
void PrintId();
void SetName(string n);
void SetState(string st);
void SetIdn(string idn);
void SetDob(string dob);
void SetExp(string exp);
string* GetInfo();
};
#endif

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!