Inheritance through multi_files C++/OOP program

oopp

Program:

Create multi files separating header and implementation file.

Create a class publication  that store title and price of a publication.from this base class derived two classes book & tape. book adds a page count and tape which adds playing time in minuts.c++

Pubb.h

#include<iostream>

class pubb

{

protected:

char title[30];

float price;

public:

void get_data();

void show_data();

};

class book:public pubb

{

int count;

public:

void get_data();

void show_data();

};

class tape:public pubb

{

float mint;

public:

void get_data();

void show_data();

 

};

 

 

Pubb.cpp

 

#include<iostream>

#include”pubb.h”

#include<string.h>

using namespace std;

void pubb::get_data()

{

cout<<“\n\nenter title of book:\n\n”;

cin.ignore();

cin.getline(title,30);

cout<<“\n\nenter price:\n\n”;

cin>>price;

}

void pubb::show_data()

{

cout<<“\n\ntitle of book is:\n\n”;

cout<<title;

cout<<“\n\nprice of the book is:\n\n”;

cout<<price;

}

void book::get_data()

{

pubb::get_data();

cout<<“\n\nenter page count:\n\n”;

cin>>count;

}

void book::show_data()

{

pubb::show_data();

cout<<“\n\npages of the book are:\n\n”<<count;

}

void tape::get_data()

{

cout<<“\n\nenter playing time in minuts:\n\n”;

cin>>mint;

 

}

void tape::show_data()

{

cout<<“\n\nplaying time in minuts of tape recorder is:\n\n”<<mint;

}

 

 

Void main()

#include<iostream>

#include”pubb.h”

#include<conio.h>

void main()

{

book b;

tape t;

 

b.get_data();

b.show_data();

 

t.get_data();

t.show_data();

 

getch();

}

Your comment are valueable