Implement the Seller class as a derived class of Person class. Create the seller.h and seller.cpp files for this class. The Seller class contains additional data members that hold a seller’s: o average star rating received from the buyers, and o total number of items sold. These data should be accessible by its derived classes. (should these data be private, public, or protected?) The following methods are included in the seller class: • A default constructor and a copy constructor • A constructor that receives all of the data for a seller. (for the constructors, make sure to call the base class constructor as appropriate) • Appropriate get and set functions for the new data in this class • print() – overrides the base class print() to print the base class data and print all additional seller data with appropriate messages. Make sure to call the base class print to print the base class data. • read() – overrides the base class read() to read the base class data and reads all additional seller data items, one data per line in the given order. Make sure to call the base class read to read in the base class data. Here is an example data for a Seller S <- indicate a seller record Joseph <- first name Edmondson <- last name jed2k <- user ID jed2k@apple.com <- email 3.6 <- seller rating 1400 <- total number of items sold
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:
Implement the Seller class as a derived class of Person class. Create the seller.h and seller.cpp
files for this class. The Seller class contains additional data members that hold a seller’s:
o average star rating received from the buyers, and
o total number of items sold.
These data should be accessible by its derived classes. (should these data be private, public, or
protected?)
The following methods are included in the seller class:
• A default constructor and a copy constructor
• A constructor that receives all of the data for a seller.
(for the constructors, make sure to call the base class constructor as appropriate)
• Appropriate get and set functions for the new data in this class
• print() – overrides the base class print() to print the base class data and print all additional
seller data with appropriate messages. Make sure to call the base class print to print the
base class data.
• read() – overrides the base class read() to read the base class data and reads all additional
seller data items, one data per line in the given order. Make sure to call the base class
read to read in the base class data.
Here is an example data for a Seller
S <- indicate a seller record
Joseph <- first name
Edmondson <- last name
jed2k <- user ID
jed2k@apple.com <- email
3.6 <- seller rating
1400 <- total number of items sold
Trending now
This is a popular solution!
Step by step
Solved in 3 steps