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<<"\ntitle"<<title<<"\nprice"<<price<<"\ntime"<<time; } }; } main() { char *title = new char[30]; float price,time; int pages; cin>>title>>price>>pages; book book1(title,price,pages); cin>>title>>price>>time; tape tape1(title,price,time); media *list[2]; list[0]=&book1; list[1]=&tape1; (*list[0]).display(); (*list[1]).display(); return 0; }...
View Full Document

This note was uploaded on 10/25/2010 for the course CMPN SEM1 taught by Professor Thakur during the Fall '06 term at University of Mumbai.

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