Jos Timanta Tarigan wrote:
>
>
> 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]
> <mailto:tmarki%40gmail.com>> wrote:
>
> > From: Tamas Marki <[email protected] <mailto:tmarki%40gmail.com>>
> > Subject: Re: [c-prog] noob question: implementation in header
> > To: [email protected] <mailto:c-prog%40yahoogroups.com>
> > Date: Monday, April 6, 2009, 7:24 AM
> > On Mon, Apr 6, 2009 at 1:18 PM, Jos Timanta Tarigan
> > <[email protected] <mailto:jos_t_tarigan%40yahoo.com>> 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:
> >
>
>
Control:: is only for static access, so you don't need it unless it is
static.