--- Comment #3 from fang at csl dot cornell dot edu 2007-07-31 21:32
---
Try compiling with -Woverloaded-virtual (C++ only). That catches the situation
you describe. (I don't think it's enabled by -Wall or -Wextra.)
--
fang at csl dot cornell dot edu changed:
What
--- Comment #4 from CyrusOmega at gmail dot com 2007-07-31 21:41 ---
Subject: Re: No warning when creating a non const derived function from a
const virtual function
Wow, thanks. I thought that -Wall was ALL warnings. grumble grumble...
Andrew
On 31 Jul 2007 21:32:32 -, fang at
--- Comment #5 from pinskia at gcc dot gnu dot org 2007-07-31 21:49 ---
http://gcc.gnu.org/onlinedocs/gcc-4.2.1/gcc/Warning-Options.html
-Wall
All of the above `-W' options combined. This enables all the warnings about
constructions that some users consider questionable, and that
--- Comment #2 from CyrusOmega at gmail dot com 2007-07-30 12:04 ---
(In reply to comment #1)
Well it is valid as B::print hides A::print.
Try doing:
#include iostream
class A {
public:
virtual char * print() const { return A\n;}
virtual ~A(){};
};
class B : public A {