Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!samsung!uunet!munnari.oz.au!bruce!trlluna!tardis!mcf From: mcf@tardis.trl.OZ.AU (Michael Flower) Newsgroups: comp.lang.c++ Subject: Virtual function problem. Keywords: C++ virtual function Message-ID: <3472@trlluna.trl.oz> Date: 8 May 91 05:12:40 GMT Sender: news@trlluna.trl.oz Lines: 32 I have come across something that appears strange. If I compile the following with the AT&T 2.1 C++ compiler: class A { virtual void fn(char); // 1 virtual void fn(char *); // 2 }; class B : public A { void fn(int); }; main() {} in the following way, I get. "t.c", line 7: warning: B::fn() hides virtual A::fn() "t.c", line 7: warning: B::fn() hides virtual A::fn() Of course B::fn() hides A::fn(). That is why I wrote it! After all A::fn() is virtual. If I change the order of lines 1 and 2 (in class A), the problem goes away. Admittedly it is only a warning, but I don't like warnings, they often spell trouble. Is this an anomally? Michael Flower Artificial Intelligence Systems Email: m.flower@trl.oz.au Telecom Research Laboratories Voice: +61 3 541 6179 Melbourne, AUSTRALIA Fax: +61 3 543 8863