C++ program to implement run time polymorphism.
Preparing for IGNOU BCA exams? Having difficulty in writing C++ programs for implementing run time polymorphism? Resolve your worries by scrolling trough this page where our ISC experts have provided suggestions and solutions.
This question is asked for 8 marks and hence requires some explanation along with the program code. Please let me know the solution.
Q) Consider a publishing company that markets both books and audio-cassettes version of its works. Create a class Publication that stores the title and price of a publication. From this class derive two classes :book which adds a page count and tape which adds a playing time in minutes. Each of these three classes should have a getdata( ) function to get its data from the user and putdata( ) function to display its data. Also, write a main( ) function that uses an array of pointers to publication. [ 8 Marks ]