#include <boost/python.hpp>
#include <string>
using namespace boost::python;
class base
{
//protected:
public:
virtual std::string f()
{
return "base::f";
}
public:
virtual std::string g() = 0;
};
class derived: public base
{
public:
std::string g()
{
return "derived::g";
}
};
struct base_wrapper: base, wrapper<base>
{
std::string f()
{
if(override f = this->get_override("f"))
{
return f();
}
return base::f();
}
std::string default_f()
{
return base::f();
}
std::string g()
{
return this->get_override("g")();
}
};
BOOST_PYTHON_MODULE(protected)
{
class_<base_wrapper, boost::noncopyable>("base")
.def("f", &base::f, &base_wrapper::default_f)
.def("g", pure_virtual(&base_wrapper::g))
;
class_<derived, bases<base>, boost::noncopyable>("derived")
.def("g", &derived::g)
;
}