E10RLVRT - { time=t; } void display() {

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<iostream.h> #include<conio.h> #include<string.h> # class media { protected: char title[30]; float price; public: media(char*s,float a) { strcpy(title,s); price=a; } virtual void display(){} }; } class book:public media { int pages; public: book(char*s,float a,int p):media(s,a) { pages=p; } void display() { cout<<"\ntitle"<<title<<"\nprice"<<price<<"\npages"<<pages; } }; } class tape:public media { float time; public: tape(char *s,float a,float t):media(s,a)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { time=t; } void display() { cout&lt;&lt;&quot;\ntitle&quot;&lt;&lt;title&lt;&lt;&quot;\nprice&quot;&lt;&lt;price&lt;&lt;&quot;\ntime&quot;&lt;&lt;time; } }; } main() { char *title = new char[30]; float price,time; int pages; cin&gt;&gt;title&gt;&gt;price&gt;&gt;pages; book book1(title,price,pages); cin&gt;&gt;title&gt;&gt;price&gt;&gt;time; tape tape1(title,price,time); media *list[2]; list[0]=&amp;book1; list[1]=&amp;tape1; (*list[0]).display(); (*list[1]).display(); return 0; }...
View Full Document

Page1 / 2

E10RLVRT - { time=t; } void display() {

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online