Deriving derived classes

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Deriving derived classes

Steven Webb-2
Section 12.1 of the lua docs shows how to derive a class in lua from a c++ class using a wrapper. However, how do you do this when the base class inherits from another class? For example, if the base class in Section 12.1 inherited from a "guitar" class, would the class_ binding look like this?

module(L)
[
  class_<base, guitar, base_wrapper>("base")
    .def(constructor<const char*>())
    .def("f", &base::f, &base_wrapper::default_f)
];

That syntax compiles for me, but I'm occasionally getting segfaults when calling virtual methods on the base class. I'm hoping that I'm not binding it correctly, because the segfaults are intermittent and I'm struggling to track it down.

Cheers.

Steve.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user