views:

261

answers:

3
class School
{
    static const int *classcapacity; 
};

This expression is from my exam and it need to get initialized how can i do that ?

+1  A: 

Probably this way:

class School{
  static const int *classcapacity   ;
};
const int *School::classcapacity = 0;
AareP
+1  A: 

If you want to initialize it with YOUR_INITIALIZER:

class School{ static const int *classcapacity ; } ;
const int* School::classcapacity = YOUR_INITIALIZER;
drhirsch
+5  A: 

You can initialize it in your source file, outside of the body of the class, just as you would any other static member variable, i.e.:

const int* School::classCapacity(new int(42));
James McNellis
This is it.Thanks !