Commit c62cd655 authored by Robert Bradshaw's avatar Robert Bradshaw

Test for non-default constructor in bases.

parent e22c29ee
...@@ -7,7 +7,10 @@ cdef extern from "shapes.h" namespace "shapes": ...@@ -7,7 +7,10 @@ cdef extern from "shapes.h" namespace "shapes":
cdef cppclass Shape: cdef cppclass Shape:
float area() float area()
cdef cppclass Circle(Shape): cdef cppclass Ellipse(Shape):
Ellipse(int a, int b) except +
cdef cppclass Circle(Ellipse):
int radius int radius
Circle(int r) except + Circle(int r) except +
......
...@@ -40,11 +40,17 @@ namespace shapes { ...@@ -40,11 +40,17 @@ namespace shapes {
Square(int side) : Rectangle(side, side) { this->side = side; } Square(int side) : Rectangle(side, side) { this->side = side; }
int side; int side;
}; };
class Circle : public Shape { class Ellipse : public Shape {
public:
Ellipse(int a, int b) { this->a = a; this->b = b; }
float area() const { return 3.1415926535897931f * a * b; }
int a, b;
};
class Circle : public Ellipse {
public: public:
Circle(int radius) { this->radius = radius; } Circle(int radius) : Ellipse(radius, radius) { this->radius = radius; }
float area() const { return 3.1415926535897931f * radius; }
int radius; int radius;
}; };
......
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