C ++ Derived class class that represents items in a library

The LibraryItemsClass stores the title and completion date. The class has two constructors:

  • Default constructor that gives the given date the value 0/0/0
  • Constructor that takes a title and gives the end date of the value 0/0/0

The class has four functions:

  • Getter and setter for set date
  • getter and setter for title
  • a function that returns a boolean on value if it is expired or not. This assumes today's date.

I need to create a derived class for this, but I have no idea? What could I do about it?

+3


source to share


1 answer


You can be as creative as you like.

Since this class describes the items in the library, you can create a derived class for books, specifically a function that sets the genre of an item to string

another that can return it. You can also execute a function that stores the number of pages for a book as int

well as another function that can return this value.

Another derived class could be for videos in this library. Again, you can create a function that performs functions such as genre preservation, video duration, etc.



The basic idea is to follow the theme of the inherited class with timelines. Anything with a fixed date can be inferred from this class and branched out in its uniqueness.

I hope this answer can inspire some ideas. :)

+1


source







All Articles