If a base class defines a staticmember there is only one such member defined for the entire hierarchy. Regardless of the number of classes derived from the base class, there exists a single instance of each staticmember. staticmembers obey normal access control: If the member is privatein the base class, then derived classes have no access to it. Assuming the member is accessible, we can access the staticmember either through the base or derived class. As usual, we can use either the scope operator or the dot or arrow member access operators.
C++ 继承和静态成员
最新推荐文章于 2023-10-25 19:15:00 发布