GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Boost-Python-Examples/Examples/inheritance/inheritance.cpp at master · zpoint/Boost-Python-Examples

Expand file tree

/

inheritance.cpp

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
43 lines (36 loc) · 957 Bytes
/

inheritance.cpp

Copy path

File metadata and controls

43 lines (36 loc) · 957 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <string>
#include <iostream>
#include <boost/python.hpp>
using namespace boost::python;
struct Base
{
Base() { std::cout << "Default constructor of Base" << std::endl; }
float get_val() { std::cout << "get_val from Base" << std::endl; return 10.0; }
virtual ~Base() { std::cout << "Destructor of Base" << std::endl; }
};
struct Derived : Base
{
Derived() { std::cout << "Deault constructor of Derived" << std::endl; }
virtual ~Derived() override { std::cout << "Destructor of Derived" << std::endl; }
};
void b(Base *)
{
std::cout << "Function b(Base *)" << std::endl;
}
void d(Derived *)
{
std::cout << "Function d(Derived *)" << std::endl;
}
Base* factory()
{
return new Derived;
}
BOOST_PYTHON_MODULE(inheritance)
{
class_<Base>("Base")
.def("get_val", &Base::get_val);
class_<Derived, bases<Base> >("Derived");
def("b", b);
def("d", d);
def("factory", factory, return_value_policy<manage_new_object>());
}
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.