• ### Announcements

#### Archived

This topic is now archived and is closed to further replies.

# Static Members in C++

## Recommended Posts

I have an Operator class I''m working on, basically every Operator stores the symbol used to invoke it, a precedence level, and the number of operands that it takes. I want to define some global Operators like add, sub, div, mul. Thing is I don''t know where to assign them their properties. I have this so far..
class Operator {
public:
...
some stuff
...
static Operator nothing, add, sub, mul, div,
and, or, assign, inc, dec, eq, neq;
};

Operator::sub.setPrecedence(2);

Thing is I keep getting compiler errors: Operator.cpp(16): error C2143: syntax error : missing '';'' before ''.'' Anyone know what''s wrong? Thanks.