diff options
author | Robert Bradshaw <robertwb@gmail.com> | 2015-02-13 11:31:48 -0800 |
---|---|---|
committer | Robert Bradshaw <robertwb@gmail.com> | 2015-02-13 11:31:48 -0800 |
commit | bc62afa3bf4bcb8aae0353e9565c9a93a4d854f6 (patch) | |
tree | 4265eba061cc22e466574eef25346f6e5259ba20 | |
parent | 3ba37707a5b7d5d62c6cf642b296602a61ce51fa (diff) | |
download | cython-bc62afa3bf4bcb8aae0353e9565c9a93a4d854f6.tar.gz |
Fix C++ example namespace
--HG--
extra : transplant_source : %CF%81%20%8A%8D%5B%D8%84%7FE%FFu%88%C5%BF%13.%A3%DD%BE
-rw-r--r-- | docs/src/userguide/wrapping_CPlusPlus.rst | 63 |
1 files changed, 29 insertions, 34 deletions
diff --git a/docs/src/userguide/wrapping_CPlusPlus.rst b/docs/src/userguide/wrapping_CPlusPlus.rst index 2ba508683..61858ab50 100644 --- a/docs/src/userguide/wrapping_CPlusPlus.rst +++ b/docs/src/userguide/wrapping_CPlusPlus.rst @@ -75,41 +75,36 @@ and the implementation in the file called :file:`Rectangle.cpp`: #include "Rectangle.h" - using namespace shapes; - - Rectangle::Rectangle(int X0, int Y0, int X1, int Y1) - { - x0 = X0; - y0 = Y0; - x1 = X1; - y1 = Y1; - } - - Rectangle::~Rectangle() - { - } - - int Rectangle::getLength() - { - return (x1 - x0); - } - - int Rectangle::getHeight() - { - return (y1 - y0); - } - - int Rectangle::getArea() - { - return (x1 - x0) * (y1 - y0); - } + namespace shapes { - void Rectangle::move(int dx, int dy) - { - x0 += dx; - y0 += dy; - x1 += dx; - y1 += dy; + Rectangle::Rectangle(int X0, int Y0, int X1, int Y1) { + x0 = X0; + y0 = Y0; + x1 = X1; + y1 = Y1; + } + + Rectangle::~Rectangle() { } + + int Rectangle::getLength() { + return (x1 - x0); + } + + int Rectangle::getHeight() { + return (y1 - y0); + } + + int Rectangle::getArea() { + return (x1 - x0) * (y1 - y0); + } + + void Rectangle::move(int dx, int dy) { + x0 += dx; + y0 += dy; + x1 += dx; + y1 += dy; + } + } This is pretty dumb, but should suffice to demonstrate the steps involved. |