Commit 1c7b7b3d authored by Robert Bradshaw's avatar Robert Bradshaw

Fix cpp class example (now that we have function overloading).

parent d69139fc
......@@ -23,7 +23,7 @@ cdef extern from "shapes.h" namespace shapes:
cdef cppclass Square(Rectangle):
int side
# __init__(int) # need function overloading
__init__(int)
int constructor_count, destructor_count
......@@ -41,7 +41,7 @@ def test_rect_area(w, h):
del rect
def test_square_area(w):
cdef Square *sqr = new Square(w, w)
cdef Square *sqr = new Square(w)
cdef Rectangle *rect = sqr
try:
return rect.area(), sqr.area()
......
......@@ -31,8 +31,6 @@ namespace shapes {
{
public:
Square(int side) : Rectangle(side, side) { this->side = side; }
/* need until function overloading in Cython */
Square(int side, int ignored) : Rectangle(side, side) { this->side = side; }
int side;
};
......
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