For Visual Studio developers, accessing static members of a parent class with the same name in a child class can be a confusing issue. PHP editor Xigua will analyze this problem in depth, explaining how subclasses access static members of parent classes, as well as potential pitfalls and solutions in different situations. Through this guide, PHP editor Xigua aims to help readers understand the nature of this problem and provide practical guidance to make their code clearer and more efficient.
First create a new parent class Transportation and set a static member m_Speed.
Then create a subclass that inherits the parent class Transportation, and also sets a static member m_Speed.
Then create an instance object of the subclass in the main function.
Then use this object to access the static member with the same name in the parent class.
Click [Local Windows Debugger] at the top.
Run the program and view the results.
The above is the detailed content of How does a subclass in vs2017 access the static member of the parent class with the same name_visual studio subclass accesses the static member method of the parent class with the same name. For more information, please follow other related articles on the PHP Chinese website!