#include #include #include #include #include namespace { class hello { public: hello(const std::string& country) { this->country = country; } std::string greet() const { return "Hello from " + country; } private: std::string country; }; std::string invite(const hello& w) { return w.greet() + "! Please come soon!"; } std::string greet(const std::string& name, const std::string& country) { return "Hello " + name + " from " + country; } } BOOST_PYTHON_MODULE(hello) { using namespace boost::python; class_("hello", init()) // Add a regular member function. .def("greet", &hello::greet) // Add invite() as a member of hello! .def("invite", invite) ; // Also add invite() as a regular function to the module. def("invite", invite); def("greet", greet); }