#include
#include < string > using namespace std; class librarian; class book {
public:
book(string, string, string);
void show_book(void);
friend librarian;
private:
string title;
string author;
string catalog;
};
book::book(string title, string author, string catalog)
{
book::title = title; book:: author=author; book: :catalog=catalog;
}
void book::show_book(void)
{
cout « "Nomi:" « title « endl; cout « "Muallif:" « author « endl; cout « "Katalog:" « catalog « endl;
}
class librarian {
public:
void change_catalog(book &, string); string get_catalog(book);
};
void Iibrarian::change_catalog(book& this_book, string new_ catalog)
{
this_book.catalog = new _catalog;
}
string librarian::get_catalog(book this_book)
{
string temp_catalog;
temp_catalog=this_book.catalog;
return(tempcatalog);
}
int main()
{
book programming ("C + + tilida dasturlashni o‘rganamiz", "Jamsa", "P101"); librarian library; programming.show_book();
library.change_catalog(programming, "Engil C + + 101"); programming.show_book();
Do'stlaringiz bilan baham: |