Class DatabaseObject
{
char author [50];
char title [50];
char date [50];
public:
DatabaseObject (char*, char*, char*);
void Display ();
};
class Painting: public DatabaseObject
{
int width, height;
public:
Painting (char*, char*, char*, int, int);
void Display ();
};
class Music: public DatabaseObject
{
char key [40];
public:
Music (char*, char*, char*, char*);
void Display ();
};
class Chamber: public Music
{
int number_of_musicians;
public:
Chamber (char*, char*, char*,char*, int);
void Display ( );
};
DatabaseObject::DatabaseObject (char* who, char* what, char* when)
{
strcpy (author, who);
strcpy (title, what);
strcpy (date, when);
}
void DatabaseObject::Display ( )
{
printf ("\n\nАвтор : %s", author);
printf ("\nНазва : %s", title);
printf ("\nДата : %s", date);
}
Painting::Painting (char* author, char* title, char* date, int w, int h):
DatabaseObject (author, title, date)
{
width = w;
height = h;
}
void Painting::Display ( )
{
DatabaseObject::Display ();
printf ("\nТип : картина");
printf ("\nрозмір: ширина = %d, висота = %d", width, height);
}
Music::Music (char* author, char* title, char* date, char* k):
DatabaseObject (author, title, date)
{strcpy (key, k);}
void Music::Display ()
{
DatabaseObject::Display ();
printf ("\nТип : музика");
printf ("\nКлюч : %s", key);
}
Chamber::Chamber (char* author, char* title, char* date, char* key, int size):
Дата добавления: 2014-12-26; просмотров: 686;