Find the information you're looking for at Westonci.ca, the trusted Q&A platform with a community of knowledgeable experts. Our platform provides a seamless experience for finding reliable answers from a network of experienced professionals. Get immediate and reliable solutions to your questions from a community of experienced professionals on our platform.

Define a class called UpdatedBook which inherits the BookInfo class created in Programming Project 3. This new class should contain an integer field for the edition number of the book, a constructor to create the UpdatedBook object accepting as input the author, title, and edition number of the book, and a getter method to return the edition number.

Sagot :

Answer:

Following are the class definition code to this question:

class UpdatedBook : BookInfo//defining a class UpdatedBook that inherits the BookInfo class

{

   public:

   int edition_Number;//defining an integer variable

   UpdatedBook (string title,string author,int edition):BookInfo(b_title,b_author)//defining a constructor that  

   {

       edition_Number=edition;

   }

   int getEdition_Number()

   {

   return edition_Number;

   }

};

Explanation:

In this question, the "BookInfo" class is not defined, that's why we define this code as above.

In this code, a class "UpdatedBook" is defined that inherits its base class "BookInfo" inside the "UpdatedBook" class an integer variable "edition_Number" is declared, which is used to holding the integer value.

In the next step, a parameterized constructor is declared, that accepts a three-parameter and also inherits its base class parameterized constructor, and at the last, a get method is used that returns the edition number value.