6 >>> test_rect_area(3, 4)
8 >>> test_square_area(15)
12 cdef extern from "shapes.h" namespace "shapes":
17 cdef cppclass Circle(Shape):
21 cdef cppclass Rectangle(Shape):
27 cdef cppclass Square(Rectangle):
31 int constructor_count, destructor_count
34 cdef Rectangle *rect = new Rectangle(10, 20)
35 cdef Circle *circ = new Circle(15)
37 return constructor_count, destructor_count
39 def test_rect_area(w, h):
40 cdef Rectangle *rect = new Rectangle(w, h)
46 def test_square_area(w):
47 cdef Square *sqr = new Square(w)
48 cdef Rectangle *rect = sqr
50 return rect.area(), sqr.area()
54 cdef double get_area(Rectangle s):
57 def test_value_call(int w):
59 >>> test_value_call(5)
62 cdef Square *sqr = new Square(w)
63 cdef Rectangle *rect = sqr
65 return get_area(sqr[0]), get_area(rect[0])