Let's say I have the following in C++

|class Base {||
||public:||
||    void doSomething() { ||
||||//do something here ||
||||}||
||};||
||
||class Derived : public Base {||
||};|

And I want to expose Derived to js including the inherited method doSomething (a toy example illustrative of a bigger issue)

Is this possible without also exposing Base? Or do I really need to recreate the entire class hierarchy in my bindings?

I know these bindings work:
|
||emscripten::class_<Base>("Base")||
||    .function("doSomething", &Base::doSomething);||
||
||emscripten::class_<Derived, emscripten::base<Base>>("Derived")||
||    .constructor();|

But this does not:

|emscripten::class_<Derived>("Derived")||
||    .constructor()||
||    .function("doSomething", &Derived::doSomething)|

unless I change the C++ definition of Derived to

|class Derived : public Base {||
||public:||
||    void doSomething() { Base::doSomething(); }||
||};||
|
I never want Base to be exposed to js just the inherited method. Is there any way to expose those without recreating the hierarchy or making trivial overrides like I do above?

Thanks!!!
Josh

--
Dr. Joshua E. Auerbach
Postdoctoral Researcher
Laboratory of Intelligent Systems
École Polytechnique Fédérale de Lausanne

--
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to