Class for Library
# include
# include
// Creating a basic template for book and magazine
class lib
{
private:
char title[20];
char pub[20];
unsigned int acc_no;
public:
//method for getting inputs
void get_details()
{
cout<<"Enter the book title"<>title;
cout<<"Enter the publisher name"<>pub;
cout<<"Enter the accession number"<>acc_no;
}
//method for showing output
void show_details()
{
cout<<"Title : "<>author;<br />
}<br />
void show_details()<br />
{<br />
lib::show_details();<br />
cout<<"Autohr : "<<author<<endl; "<<endl;="" :="" char="" cin="" class="" cout<<"enter="" derived="" editor's="" editor[20];="" for="" from="" get_details()="" lib::get_details();="" lib="" magazine="" magz="" name:="" private:="" private="" public:="" the="" void="" {="" };="" }="">>editor;<br />
}<br />
void show_details()<br />
{<br />
lib::show_details();<br />
cout<<"editor : "<<editor<<endl;<br>
}<br />
};<br />
void main(void)<br />
{<br />
clrscr();<br />
//creating objects<br />
book b;<br />
magz m;<br />
b.get_details();<br />
m.get_details();<br />
b.show_details();<br />
m.show_details();<br />
getch();<br />
}<br />
</editor<<endl;<br></author<<endl;>
# include
// Creating a basic template for book and magazine
class lib
{
private:
char title[20];
char pub[20];
unsigned int acc_no;
public:
//method for getting inputs
void get_details()
{
cout<<"Enter the book title"<
cout<<"Enter the publisher name"<
cout<<"Enter the accession number"<
}
//method for showing output
void show_details()
{
cout<<"Title : "<
Comments
Post a Comment