Re: Overloading method in derived class

Parveen Kaler <[email protected]>
Newsgroups gmane.games.devel.general
Message-ID <[email protected]>
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 [email protected]
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








-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Gamedevlists-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gamedevlists-general
Archives:
http://sourceforge.net/mailarchive/forum.php?forum_id=557
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.