you don't declare them control::init in the header, just do void init also when you return the variable, just use the variable name, or this->
Thanks, Tyler Littlefield Web: tysdomain.com email: [email protected] My programs don't have bugs, they're called randomly added features. ----- Original Message ----- From: Jos Timanta Tarigan To: [email protected] Sent: Monday, April 06, 2009 2:46 PM Subject: Re: [c-prog] noob question: implementation in header well actually i dont even use a static anymore. this is the whole class: #ifndef CONTROL_H #define CONTROL_H #include "includes.h" class Control { public: Control() { } void Control::init() { for(int i = 0; i < 128; i++) Control::g_Keys[i] = false; } bool getKey(int key) { return Control::g_Keys[key]; } void setKey(int key, bool val) { Control::g_Keys[key] = val; } private: bool g_Keys[128]; }; #endif it seems very simple but i got an error that the method init() is not part of the class. --- On Mon, 4/6/09, Tamas Marki <[email protected]> wrote: > From: Tamas Marki <[email protected]> > Subject: Re: [c-prog] noob question: implementation in header > To: [email protected] > Date: Monday, April 6, 2009, 7:24 AM > On Mon, Apr 6, 2009 at 1:18 PM, Jos Timanta Tarigan > <[email protected]> wrote: > > > When you are defining a static member in a class, you need > to define > the 'storage space'. Let me demonstrate with a > simple example: > [Non-text portions of this message have been removed]
