Write the definition of the member functions to implement


Example 12-9

#include
Using namespace std;

Class personType
{
Public:
Void print () const;
.
.
Void setName (string first, string last);
.
.
String getFirstName () const;
.
.
String getLastName () const;
.
.
personType (string first = " ", string last= " ");
Private:
String firstName;
String lastName;
};


Example 12-9 defined a class personType to store the name of a person. The member functions that we included merely print the name and set the name of a person. Redefine the class peronType so that, in addition to what the existing class does, you can:

a) Set the first name only

b) Set the last name only

c) Store and set the middle name

d) Check whether a given first name is the same as the first name of this person

e) Check whether a given last name is the same as the name of this person

Write the definition of the member functions to implement the operations for this class. Also, write a program to test various operations on this class.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Write the definition of the member functions to implement
Reference No:- TGS01247221

Now Priced at $20 (50% Discount)

Recommended (99%)

Rated (4.3/5)