Commit 2f967a63 authored by Robert Bradshaw's avatar Robert Bradshaw

Merge pull request #518 from davidalbertonogueira/master

Fix errors in example code sections in documentation.
parents 073d205a 075530a1
...@@ -52,7 +52,7 @@ document. Let's assume it will be in a header file called ...@@ -52,7 +52,7 @@ document. Let's assume it will be in a header file called
Rectangle(int x0, int y0, int x1, int y1); Rectangle(int x0, int y0, int x1, int y1);
~Rectangle(); ~Rectangle();
int getArea(); int getArea();
void getSize(int* width, int* height) void getSize(int* width, int* height);
void move(int dx, int dy); void move(int dx, int dy);
}; };
} }
...@@ -81,8 +81,8 @@ and the implementation in the file called :file:`Rectangle.cpp`: ...@@ -81,8 +81,8 @@ and the implementation in the file called :file:`Rectangle.cpp`:
} }
void Rectangle::getSize(int *width, int *height) { void Rectangle::getSize(int *width, int *height) {
width = x1 - x0; (*width) = x1 - x0;
height = y1 - y0; (*height) = y1 - y0;
} }
void Rectangle::move(int dx, int dy) { void Rectangle::move(int dx, int dy) {
...@@ -247,8 +247,8 @@ forwarding methods. So we can implement the Python extension type as:: ...@@ -247,8 +247,8 @@ forwarding methods. So we can implement the Python extension type as::
self.c_rect = Rectangle(x0, y0, x1, y1) self.c_rect = Rectangle(x0, y0, x1, y1)
def get_area(self): def get_area(self):
return self.c_rect.getArea() return self.c_rect.getArea()
def get_size(self) def get_size(self):
int width, int height cdef int width, height
self.c_rect.getSize(&width, &height) self.c_rect.getSize(&width, &height)
return width, height return width, height
def move(self, dx, dy): def move(self, dx, dy):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment