帮忙看看这个程序出什么问题了
下面的程序是为了说明truct也能和class一样,但是不知道为什么会有这么多错误,请高手帮忙看看#include<iostream>
using namespace std;
enum breed{ golden, cairn,dandie,shetland,doberman, lab};
struct mannal
{
public:
mammal():itsage(2),itsweigh(5){}
~mammal(){}
int getage()const
{
return itsage;
}
void setage(int age)
{
itsage=age;
}
int getweight() const
{
return itweight;
}
void setweight(int weight)
{
itsweight=weight;
}
void speak()const
{
cout<<"mammal sound"<<endl;
}
void sleep()const
{
cout<<"I'm sleeping"<<endl;
}
protected:
int itsage;
int itsweight;
};
struct dog:public mammal
{
public:
dog():itsbreed(golden){}
~dog(){};
breed getbreed()const
{
return itsbreed;
}
void setbreed(breed breed)
{
itsbreed=breed;
}
void wagtail()const
{
cout<"tail wagging"<<endl;
}
void begforfood()const
{
cout<<"begging for food"<<endl;
}
private:
breed itsbreed;
};
void main()
{
dog fido;
fido.speak();
fido.wagtail();
cout<<"fido is "<<fido.getage()<<"years old"<<endl;
}