Question: 8 . 1 6 LAB: State ID renewal ( Copy assignment ) Given class StateID, overload the assignment operator ( in StateID.cpp ) so as
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 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", and 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: N DOB: EXP: New ID: Name: John Doe State: Pennsylvania IDN: DOB: EXP:
StateIDh is a read only file, here is it below
#ifndef STATEIDH
#define STATEIDH
#include
using namespace std;
class StateID
private:
string idInfo;
public:
StateID;
StateIDstring info;
void operatorconst StateID &id;
void PrintId;
void SetNamestring n;
void SetStatestring st;
void SetIdnstring idn;
void SetDobstring dob;
void SetExpstring exp;
string GetInfo;
;
#endif
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
