Ticket #6895: boosterror.cpp
File boosterror.cpp, 424 bytes (added by , 10 years ago) |
---|
Line | |
---|---|
1 | #include <iostream> |
2 | #include <boost/shared_ptr.hpp> |
3 | #include <boost/python.hpp> |
4 | |
5 | using boost::shared_ptr; |
6 | using namespace boost::python; |
7 | |
8 | struct A { |
9 | virtual void f() { std::cout << "A OK!\n"; } |
10 | }; |
11 | |
12 | struct B : public A { |
13 | void f() { std::cout << "B OK!\n"; } |
14 | }; |
15 | |
16 | BOOST_PYTHON_MODULE(boosterror) |
17 | { |
18 | |
19 | class_<A, shared_ptr<A> >("A") |
20 | .def("f", &A::f) |
21 | ; |
22 | |
23 | class_<B, shared_ptr<B>, bases<A> >("B") |
24 | ; |
25 | |
26 | } |