4 >>> test_rect_area(3, 4)
6 >>> test_square_area(15)
10 cdef extern from "shapes.h" namespace "shapes":
15 cdef cppclass Circle(Shape):
19 cdef cppclass Rectangle(Shape):
25 cdef cppclass Square(Rectangle):
29 int constructor_count, destructor_count
32 cdef Rectangle *rect = new Rectangle(10, 20)
33 cdef Circle *circ = new Circle(15)
35 return constructor_count, destructor_count
37 def test_rect_area(w, h):
38 cdef Rectangle *rect = new Rectangle(w, h)
44 def test_square_area(w):
45 cdef Square *sqr = new Square(w)
46 cdef Rectangle *rect = sqr
48 return rect.area(), sqr.area()
52 cdef double get_area(Rectangle s):
55 def test_value_call(int w):
57 >>> test_value_call(5)
60 cdef Square *sqr = new Square(w)
61 cdef Rectangle *rect = sqr
63 return get_area(sqr[0]), get_area(rect[0])