Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
Hi
I'm learning the c++ language with a book i've got (c++ in 24 hours from Jesse Liberty). But when testing the use of classes, i've got a problem compiling this code:
//main.cpp #include "mbed.h" #include "Cat.h" typedef DigitalOut DO; DO myled1(LED1); DO myled2(LED2); int main() { cat Frisky(1); printf("START\n\r"); printf("AGE 1:%i\n\r", Frisky.GetAge()); Frisky.SetAge(5); printf("AGE 2:%i\n\r", Frisky.GetAge()); printf("STOP\n\r"); while(1) { myled1 = 1; wait(0.2); myled1 = 0; wait(0.2); } } //Cat.h class Cat { public: Cat (int initialAge); int GetAge(); void SetAge(int age); private: int itsAge; ); //Cat.cpp #include "Cat.h" Cat::Cat(int initialAge) { itsAge = initialAge; ) int Cat::GetAge() { return itsAge; } void Cat::SetAge(int age){ itsAge = age; }Compiler give's me the error: Expected a declaration on Cat.h
What am I doing wrong?