From f5416ebce07b914ed6fd83754f414e53bd2b5563 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sat, 10 Mar 2001 00:36:03 +0000 Subject: [PATCH] Fixed some doc bugs and improved an example [SVN r9533] --- doc/overriding.html | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/overriding.html b/doc/overriding.html index b29bf0e6..0fc7a2e6 100644 --- a/doc/overriding.html +++ b/doc/overriding.html @@ -142,6 +142,7 @@ hello_class.def(&hello::greet, "greet", &hello_callback::default_gree
 struct baz {
     virtual int pure(int) = 0;
+    int calls_pure(int x) { return pure(x) + 1000; }
 };
 
 struct baz_callback {
@@ -154,7 +155,7 @@ BOOST_PYTHON_MODULE_INIT(foobar)
     {
        boost::python::module_builder foobar("foobar");
        boost::python::class_builder<baz,baz_callback> baz_class("baz");
-       baz_class.def(&baz::pure, "pure");
+       baz_class.def(&baz::calls_pure, "calls_pure");
     }
     catch(...)
     {
@@ -173,12 +174,18 @@ BOOST_PYTHON_MODULE_INIT(foobar)
 Traceback (innermost last):
   File "<stdin>", line 1, in ?
 AttributeError: pure
+>>> x.calls_pure(1)
+Traceback (innermost last):
+  File "<stdin>", line 1, in ?
+AttributeError: pure
 >>> class mumble(baz):
 ...    def pure(self, x): return x + 1
 ...
 >>> y = mumble()
 >>> y.pure(99)
 100
+>>> y.calls_pure(99)
+1100
 

Private Non-Pure Virtual Functions

@@ -192,6 +199,7 @@ this limited way without breaking binary compatibility (though it will certainly break the ODR). +

Next: Function Overloading Previous: Exporting Classes