Jump to content

Static class members


photo

Recommended Posts

I try create class:

#ifndef __MATH_H__
#define __MATH_H__

class Math
{
public:
	int a = 2;
};

#endif

 

and using member a like static:

 

log.message("a = " + Math::a);

 

but a always = 0

 

If I use namespace:

#ifndef __MATH_H__
#define __MATH_H__

namespace Math
{
int a = 2;
};

#endif

 

it works.

 

Is it possible to use classes with static members, or is it be in future releases?

Link to comment
×
×
  • Create New...