help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Warning when hiding non-virtual method


From: Marcel Loose
Subject: Warning when hiding non-virtual method
Date: Wed, 30 Mar 2005 17:55:04 +0200

Hi,

I was wondering whether it is possible to have GCC produce a warning
whenever a non-virtual method in the base class is hidden by a method in the
derived class. I know this is possible for virtual methods by using
the -Woverload-virtual switch, but I haven't been able to find the
equivalent for non-virtual methods.

For example, I would like GCC to produce a warning about the following code.

class A
{
public:
  void f() {}
};

class B : public A
{
public:
  void f(int) {}
};

Something like:
warning: void A::f() was hidden by void B::f(int)

Anyone?

Kind regards,

Marcel Loose.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]