Question: Using C++, Create a base class named Book. Data fields include title and author; functions include those that can set and display the fields. Derive

Using C++,

Create a base class named Book. Data fields include title and author; functions include those that can set and display the fields.

Derive two classes from the Book class: Fiction, which also contains a numeric grade reading level, and NonFiction, which contains a variable to hold the number of pages.

The functions that set and display data field values for the subclasses should call the appropriate parent class functions to set and display the common fields, and include specific code pertaining to the new subclass fields.

Write a test program that demonstrates the use of the classes and their functions.

Sample Run Book is Scarlet Letter by Hawthorne Reading level is 10 Book is Log Cabin Building by Landers 328 pages 

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 Databases Questions!