Hi iam begginer at c++ i have class with static methods and i cant access them it throws me an error
1>------ Build started: Project: CPractice, Confi
static string name;
As it is static
, this line only declares name
- you need to define it too. Simply place this below your class definition:
string CPractice::name;
If you end up moving your class to a corresponding header and implementation file, make sure you place this definition in the implementation file. It should only be defined in a single translation unit.