Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
emscripten-core
GitHub Repository: emscripten-core/emscripten
Path: blob/main/test/embind/test_embind_subclass_pointer.cpp
7085 views
1
#include <emscripten/bind.h>
2
3
using namespace emscripten;
4
5
struct Base {
6
virtual ~Base() {}
7
};
8
9
struct Sub : Base {
10
Sub(Base* b) {}
11
};
12
13
struct SubWrapper : wrapper<Sub> {
14
EMSCRIPTEN_WRAPPER(SubWrapper);
15
};
16
17
EMSCRIPTEN_BINDINGS(test) {
18
class_<Base>("Base")
19
.constructor<>()
20
;
21
22
class_<Sub>("Sub")
23
.allow_subclass<SubWrapper>("SubWrapper", constructor<Base*>(), allow_raw_pointer<arg<0>>())
24
;
25
}
26
27
int main() {
28
return 0;
29
}
30
31