Здраствуйте, Я совсем недавно начал изучать С++, и дошёл до классов, но есть проблема, код компилируется с ошибкой, код по книге писал, в чём проблема?
Код
#include <iostream>
using namespace std;
class Cat
{
public:
int GetAge;
void SetAge (int age);
void Meow();
private:
int itsAge;
};
int Cat::GetAge()
{
return itsAge;
}
void Cat::SetAge(int age)
{
itsAge = age;
}
void Cat::Meow()
{
cout << "Meow.\n";
}
int main()
{
Cat Frisky;
Frisky.SetAge(6);
Frisky.Meow();
cout << "Frisky is à cat who is ";
cout << Frisky.QetAge() << " years old.\n";
Frisky.Meow();
// return 0;
system("PAUSE >> void");
}
Вот собственно ошибки
Код
17 C:\Users\User\Desktop\main.cpp no `int Cat::GetAge()' member function declared in class `Cat'
35 C:\Users\User\Desktop\main.cpp no `void Cat::Meow()' member function declared in class `Cat'
35 C:\Users\User\Desktop\main.cpp `void Cat::Meow()' and `void Cat::Meow()' cannot be overloaded
C:\Users\User\Desktop\main.cpp In function `int main()':
45 C:\Users\User\Desktop\main.cpp 'class Cat' has no member named 'Meow'
47 C:\Users\User\Desktop\main.cpp 'class Cat' has no member named 'QetAge'
48 C:\Users\User\Desktop\main.cpp 'class Cat' has no member named 'Meow'
C:\Users\User\Desktop\Makefile.win [Build Error] [main.o] Error 1