lua-users home
lua-l archive

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


How do I achieve the equivalent of the infamous casting pointers ?

suppose I have

class A
{
    A();
    virtual ~A();
};
class B : public A
{
    B();
    void only_defined_in_B();
};
static A* seed() { return new B; }


If I do the following in lua

lseed = seed()
lseed:only_defined_in_B()    -- causes error


Now I know that lseed is a class B object  - but I cannot
access only_defined_in_B() routines of object lseed.

Is there a way by which I can acomplish the above even if that
involves violating every coding ethic.

Any help would be greatly appreciated.

Thanx.

--Supratik