Create a Person class for a user of the system. Create person.h and person.cpp files for this class. The class should contain the following data of a person in the system: • first name, • last name, • user ID, and • email address. These data should be accessible in its derived class. (Consider should the data be private, public, or protected?) This class should contain: • a default constructor, • a value constructor that receives all of the data to be placed into the data members as its parameters, • a copy constructor. The class should also contain: • “get” methods to allow the client to obtain information about a person. o getFirstName, getLastName, getID, getEmail • “set” methods to allow the client to assign information to a seller. o setFirstName, setLastName, setID, setEmail, and optionally setAllInfo • overloaded operators o overloaded == method that returns true if two sellers have identical names and email address; otherwise it returns false. o overloaded !=, <, and > operators (for > and < operators, comparisons are based on last names) • An overloaded assignment = operator. • Overloaded << and >> operators (consider should these be friend functions?) • print() – a virtual function that displays on screen all the information of a person with appropriate messages • read() – a virtual function that reads in the information of a Person from an input file stream Consider which of these methods should be const method?
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
Create a Person class for a user of the system. Create person.h and person.cpp files for this class.
The class should contain the following data of a person in the system:
• first name,
• last name,
• user ID, and
• email address.
These data should be accessible in its derived class. (Consider should the data be private, public,
or protected?)
This class should contain:
• a default constructor,
• a value constructor that receives all of the data to be placed into the data members as its
parameters,
• a copy constructor.
The class should also contain:
• “get” methods to allow the client to obtain information about a person.
o getFirstName, getLastName, getID, getEmail
• “set” methods to allow the client to assign information to a seller.
o setFirstName, setLastName, setID, setEmail, and optionally setAllInfo
• overloaded operators
o overloaded == method that returns true if two sellers have identical names and
email address; otherwise it returns false.
o overloaded !=, <, and > operators (for > and < operators, comparisons are based
on last names)
• An overloaded assignment = operator.
• Overloaded << and >> operators (consider should these be friend functions?)
• print() – a virtual function that displays on screen all the information of a person with
appropriate messages
• read() – a virtual function that reads in the information of a Person from an input file stream
Consider which of these methods should be const method?
Trending now
This is a popular solution!
Step by step
Solved in 3 steps