public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Function overloading
@ 2007-03-21  7:26 Wesley Smith
       [not found] ` <32380a010703210019o70bfe7d4ge45ced3c3838f412@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Wesley Smith @ 2007-03-21  7:26 UTC (permalink / raw)
  To: gcc-help

I have a question about function overloading.  I'm getting alot of
errors when I do the following

class A
{
    void draw();
};


class B : public A
{
     static int draw(lua_State *L);
     static B * get(lua_State *L, int i);
}

//bad
int B :: draw(lua_State *L)
{
      B *b = get(L, 1);
      b->draw()   //<--- produces error because it things I'm calling
the static B function
}


//good
int B :: draw(lua_State *L)
{
      B *b = get(L, 1);
      b->A::draw()   //<--- no errors
}



Shouldn't the compiler understand that I'm actually calling the
superclass' draw method, especially since the class' draw method is
static and I'm calling it as an instance method?

thanks,
wes

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-03-21 12:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-21  7:26 Function overloading Wesley Smith
     [not found] ` <32380a010703210019o70bfe7d4ge45ced3c3838f412@mail.gmail.com>
2007-03-21 10:38   ` Wesley Smith
2007-03-21 11:57     ` Andrew Haley
2007-03-21 12:26     ` Atwood, Robert C

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).