Fix cpp class example (now that we have function overloading).
authorRobert Bradshaw <robertwb@math.washington.edu>
Thu, 9 Jul 2009 07:46:03 +0000 (00:46 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Thu, 9 Jul 2009 07:46:03 +0000 (00:46 -0700)
tests/run/cpp_classes.pyx
tests/run/shapes.h

index 056ae81e776eddf61438b357def9a438d5fb573c..84cbfaa03ceed7eeb4369e605fddc00b8c2cd86d 100644 (file)
@@ -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()
index 3106d01c0cf35b3ba27d468214cb9b4af78e6581..033a30b83ae5ac663b50dbbc037f44e5294fe3b6 100644 (file)
@@ -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;
     };