#include"iostream.h"
#include"string.h"
#include"conio.h"
class media
{
protected:
char title[50];
float price;
public:
media(char *s,float a)
{
strcpy(title,s);
price=a;
}
virtual void display() { } //empty vitual function
};
class book:public media
{
int pages;
public:
book(char *s, float a, int p):media(s,a)
{
pages=p;
}
void display();
};
class tape:public media
{
float time;
public:
tape(char *s, float a, float t):media(s,a)
{
time=t;
}
void display();
};
void book::display()
{
cout<<"\n Title:"<
cout<<"\n Pages:"< cout<<"\n Price:"<}
void tape::display()
{
cout<<"\n Title:"< cout<<"\n Play time:"<
No comments:
Post a Comment