7
是否继承了静态字段?
当静态成员被继承时,它们对于整个层次结构还是整个类都是静态的,即: class SomeClass { public: SomeClass(){total++;} static int total; }; class SomeDerivedClass: public SomeClass { public: SomeDerivedClass(){total++;} }; int main() { SomeClass A; SomeClass B; SomeDerivedClass C; return 0; } 在所有这三种情况下总计为3,或者对于2为SomeClass1是SomeDerivedClass?
102
c++
inheritance
static