Show: Delphi C++
Display Preferences

OPM -- Overriding Private Method

From RAD Studio
Jump to: navigation, search

Go Up to C++ Audits

Description

A subclass should not contain a method with the same name and signature as in a superclass if these methods are declared to be private. If this situation is detected, a warning message is generated.

Incorrect

 class Window {
   void init() {
     ...
   }
 };
 
 class Button : public Window {
   void init() {
      ...
   }
 };

Correct

 class Window {
   void initWindow() {
      ...
   }
 };
 
 class Button : public Window {
   void initButton() {
      ...
   }
 };

See Also

Personal tools
RAD Studio 10.2 Tokyo
In other languages
Previous Versions
Assistance