0% found this document useful (0 votes)
4 views1 page

Inheritance Problem

The document outlines a problem statement for a Library System, requiring the creation of a base class 'Book' with attributes for title, author, and publication year, along with a method to display this information. It specifies two derived classes, 'EBook' and 'PrintedBook', which inherit from 'Book' and add additional attributes for file size and number of pages, respectively, while overriding the display method to include these details. The document serves as a guideline for implementing a class hierarchy in object-oriented programming.

Uploaded by

Christian
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Inheritance Problem

The document outlines a problem statement for a Library System, requiring the creation of a base class 'Book' with attributes for title, author, and publication year, along with a method to display this information. It specifies two derived classes, 'EBook' and 'PrintedBook', which inherit from 'Book' and add additional attributes for file size and number of pages, respectively, while overriding the display method to include these details. The document serves as a guideline for implementing a class hierarchy in object-oriented programming.

Uploaded by

Christian
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Problem Statement: Library System

Create a base class Book that represents a book in a library.


Then, create two derived classes EBook and PrintedBook that
inherit from the Book class.

Requirements
1. Book Class:
o Attributes: title, author, pub_year
o Method: display_info() to display the book's
information

[Link](“Book Title: ”+[Link]);


[Link](“Book Author: ”+[Link]);
[Link](“Book Pub Year: ”+this.pub_year);

2. EBook Class (inherits from Book):


o Additional Attribute: file_size (in MB)
o Override Method: display_info() to include file size

3. PrintedBook Class (inherits from Book):


o Additional Attribute: noOfPages
o Override Method: display_info() to include the
number of pages

You might also like