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;
}
void show_details()
{
lib::show_details();
cout<<"Autohr : "<>editor;
}
void show_details()
{
lib::show_details();
cout<<"editor : "<
}
};
void main(void)
{
clrscr();
//creating objects
book b;
magz m;
b.get_details();
m.get_details();
b.show_details();
m.show_details();
getch();
}
# 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 : "<
}
void show_details()
{
lib::show_details();
cout<<"Autohr : "<
}
void show_details()
{
lib::show_details();
cout<<"editor : "<
};
void main(void)
{
clrscr();
//creating objects
book b;
magz m;
b.get_details();
m.get_details();
b.show_details();
m.show_details();
getch();
}
Comments
Post a Comment