From f66cd06361765363cd71cfc8f15d21b660537891 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Tue, 31 Oct 2000 22:03:56 +0000 Subject: [PATCH] Fix bug in example Add explanatory text Fix links to Next chapter [SVN r8081] --- overriding.html | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/overriding.html b/overriding.html index 82cb442d..ecf7efb7 100644 --- a/overriding.html +++ b/overriding.html @@ -50,8 +50,8 @@ struct world_callback : hello::world // Something Python can call in case there is no override of get() - const char* default_get() const - { return this->hello::world::get(); } + const char* default_get(hello::world* self) const + { return self->hello::world::get(); } private: PyObject* m_self; // A way to hold onto the Python object }; @@ -97,7 +97,8 @@ world_class.def(&hello::world::get, "get", &world_callback::default_get) inside of hello::world." One of the goals of py_cpp is to be minimally intrusive on an existing C++ design. In principle, it should be possible to expose the interface for a 3rd party library without changing - it. + it. To unintrusively hook into the virtual functions so that a Python + override may be called, we must use a derived class.

Pure Virtual Functions

@@ -162,7 +163,7 @@ AttributeError: pure

Prev: A Simple Example Using py_cpp Next: A Peek Under the Hood Up: Function Overloading Up: Top

© Copyright David Abrahams 2000. Permission to copy, use, modify, @@ -171,5 +172,5 @@ AttributeError: pure express or implied warranty, and with no claim as to its suitability for any purpose.

- Updated: Sept 30, 2000 + Updated: Oct 30, 2000