Re: Abstract classes

Evan <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
You only need to worry about the wrapper if you want to derive classes from A in Lua.

Otherwise, you can do something like this:

using namespace luabind;
module(L)
[
class_<A>("A")
    // can't bind constructor because it is abstract
    .def( "bar", &A::bar )
class <B, A>("B")
    .def( constructor<>() ) // implicit B()
];

-Evan



liam mail wrote:
> If there are two classes say A and B in which A is abstract and B is 
> derived from A.
> I want Lua to know about A and B, how can they be registered?
> I see in test_abstract_base you register an abstract class which is 
> derived from "abstract_wrap" and then "concrete" is defined in Lua code.
> So correct me if I am wrong but this is not what I am after, could 
> anyone give me a snippet which would achieve letting Lua know about both 
> A and B.
> Thanks.
> 
> For clarity
> 
> struct A
> {
> virtual ~A(){}
> virtual void bar()=0;
> };
> 
> struct B : A
> {
> void bar(){}
> };
> 
> 
> ------------------------------------------------------------------------
> 
> ------------------------------------------------------------------------------
> Join us December 9, 2009 for the Red Hat Virtual Experience,
> a free event focused on virtualization and cloud computing. 
> Attend in-depth sessions from your desk. Your couch. Anywhere.
> http://p.sf.net/sfu/redhat-sfdev2dev
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> luabind-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/luabind-user


------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
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.