V
volkov9999
помогите разобраться. В приложенном коде вроде все правильно, однако компилятор недоволен... что надо сделать, чтобы счастье настало?
#include <iostream.h>
#include <conio.h>
enum BREED {GOLDEN, CAIRN, DANDIE, SHETLAND, DOBERMAN, LAB };
class Mammal
{
Mammal(): itsAge(2), itsWeight(5) {}
~Mammal() {}
int GetAge() const {return itsAge; }
void SetAge (int age) { itsAge= age;}
int GetWeight() const { return itsWeight; }
void SetWeight (int weight) {itsWeight= weight; }
void Speak() const { cout <<"Mammal sound!\n"; }
void Sleep() const {cout<< "shhh. I'm sleeping. \n "; }
protected:
int itsAge;
int itsWeight;
};
class Dog: public Mammal
{
public:
Dog():itsBreed(GOLDEN){}
public:
~Dog() {}
BREED GetBreed() const {return itsBreed; }
void SetBreed (BREED breed) { itsBreed = breed; }
void WagTail () const {cout<<"Tail Wagging...\n"; }
void BegForFood() const {cout<<"Begging for food...\n"; }
private:
BREED itsBreed;
};
int main ()
{
Dog fido;
fido.Speak();
fido.WagTail();
cout<<"Fido is "<< fido.GetAge()<<"years old \n";
getch();
return 0;
}
#include <iostream.h>
#include <conio.h>
enum BREED {GOLDEN, CAIRN, DANDIE, SHETLAND, DOBERMAN, LAB };
class Mammal
{
Mammal(): itsAge(2), itsWeight(5) {}
~Mammal() {}
int GetAge() const {return itsAge; }
void SetAge (int age) { itsAge= age;}
int GetWeight() const { return itsWeight; }
void SetWeight (int weight) {itsWeight= weight; }
void Speak() const { cout <<"Mammal sound!\n"; }
void Sleep() const {cout<< "shhh. I'm sleeping. \n "; }
protected:
int itsAge;
int itsWeight;
};
class Dog: public Mammal
{
public:
Dog():itsBreed(GOLDEN){}
public:
~Dog() {}
BREED GetBreed() const {return itsBreed; }
void SetBreed (BREED breed) { itsBreed = breed; }
void WagTail () const {cout<<"Tail Wagging...\n"; }
void BegForFood() const {cout<<"Begging for food...\n"; }
private:
BREED itsBreed;
};
int main ()
{
Dog fido;
fido.Speak();
fido.WagTail();
cout<<"Fido is "<< fido.GetAge()<<"years old \n";
getch();
return 0;
}