Possible Duplicate:
When do I use a dot, arrow, or double colon to refer to members of a class in C++?
When I try to access my static variable using Class.Variable
I get the error that Error left of 'Variable' must have class/struct/union
and when I do Class::Variable
I get no error. Although in both cases I get Variable
through intellisense. What exactly is the different between .
and ::
in this case?
Static members of a class can be accessed through two ways
(a) With instances of class - Use .
e.g. obj.variable
(b) Without instance of class - Use ::
e.g. class::variable