#include <iostream>
class Papa
{
protected:
char gesund[100];
public:
void Init(char * ginfo);
char* GetGesundheit(void);
};
class Mama
{
protected:
int iq;
public:
void Init(int Intelligenz);
int GetIQ(void);
};
class Sohn : public Papa, public Mama
{
private:
int Maturanote;
public:
void Init(int Intelligenz, char* ginfo, int minfo);
int GetMaturanote(void);
};
void Papa::Init(char* ginfo)
{
strcpy(gesund,ginfo);
}
char* Papa::GetGesundheit()
{
return gesund;
}
void Mama::Init(int Intelligenz)
{
iq=Intelligenz;
}
int Mama::GetIQ()
{
return iq;
}
void Sohn::Init(int Intelligenz, char* ginfo, int minfo)
{
iq = Intelligenz;
strcpy(gesund,ginfo);
Maturanote=minfo;
}
int Sohn::GetMaturanote()
{
return Maturanote;
}
int main()
{
Papa DerArbeiter;
Mama DieSchriftstellerin;
DerArbeiter.Init("toll");
DieSchriftstellerin.Init(77);
std::cout << "Die Schriftstellerin als Mama hat einen IQ von " << DieSchriftstellerin.GetIQ() << ".\n";
std::cout << "Die Gesundheit des Arbeiters als Papa ist mit " << DerArbeiter.GetGesundheit() << " zu beurteilen.\n\n";
Sohn DerSportler;
DerSportler.Init(88, "durchtrainiert", 2);
std::cout << "Der Sportler, der Sohn vom Arbeiter hat einen IQ von " << DerSportler.GetIQ() << ".\n";
std::cout << "Seine Gesundheit ist mit " << DerSportler.GetGesundheit() << " zu beurteilen.\n";
std::cout << "Seine Matura hat er mit der Note " << DerSportler.GetMaturanote() << " absolviert. \n";
return 0;
}