Get the App
SLTechnology News&Howtos  ›  Development  › 

What does it mean to rewrite, reload and hide C++ respectively?

Shulou Source: shulou.com Published: 2022-06-03 10:18:55 11月15日 Update

Many novices are not very clear about what it means to rewrite, reload and hide C++. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.

Rewrite

Definition of rewriting: rewriting occurs in the inheritance relationship between the base class and the derived class, and the base class member function defined as a virtual function is redefined and implemented by the derived class. At the same time, the method of the base class is hidden (that is, when the derived class calls the override method, the derived class redefines the method instead of the base class method). For example:

# include using std::cout;using std::endl;class Base {public: Base () {}; ~ Base () {}; virtual void fun () {cout

Tags: Functions types members pointers parameters methods different subclasses same function guarantee clocked numbers number code global point help meaning polymorphism clear Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Docker Shulou Information Xiaomi OPPO Reno