Re: [GD-General] Overloading method in derived class
Brought to you by:
vexxed72
From: Parveen K. <pk...@al...> - 2004-02-04 18:50:19
|
I can't seem to find the relevant section in the standard. (Didn't try to hard). But GOTW #5 explains the problem well: http://gotw.ca/gotw/005.htm "[RULE] When providing a function with the same name as an inherited function, be sure to bring the inherited functions into scope with a "using" declaration if you don't want to hide them." On Wed, 4 Feb 2004 19:14:56 +0100 gam...@li... wrote: > Hello all, > I know this is a C++ specific question but i don't know how=20 > to search the answer in google. > > I have the following code : > struct Toto { void Add(int x){} }; > > struct Titi : public Toto { void Add(int x, int y){} }; > > int main ()=20 > > {=20 > > Titi titi; > > titi.Add(1); > > } > > And both MSVC 7 and gcc give me=20 > > error : 'Titi::Add' : function does not take 1 parameters > > sure i could write titi.Toto::Add(1); and this will work but=20 > > i want to avoid such a pain. > > is it a C++ specification problem or a compiler problem ? > > Thanks > > ------------------------ > > Lagarde S=E9bastien > > Neko entertainment |