When static members are inherited, are they static for the entire hierarchy, or just that class, i.e.:
class SomeClass
{
public:
SomeClass(){total++;}
#include
using namespace std;
class A
{
public:
A(){total++; cout << "A() total = "<< total << endl;}
static int total;
};
int A::total = 0;
class B: public A
{
public:
B(){total++; cout << "B() total = " << total << endl;}
};
int main()
{
A a1;
A a2;
B b1;
return 0;
}
It would be:
A() total = 1
A() total = 2
A() total = 3
B() total = 4