Function overloading

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux