I could not understand why when declaration a static variable causes a external symbol error. Who can describe the differences between below cases?
1) OK
class TrainComposition
{
public:
int wagons;
...
}
2) Error (unresolved external symbol)
class TrainComposition
{
public:
static int wagons;
...
}
3) Error (unresolved external symbol)
class TrainComposition
{
static int wagons;
public:
...
}