1
struct point {
    int x; int y;
    point(int a, int b) {
        x = a;
        y = b;
    }
    int sum = x + y;
};
class circle {
public:
    point p;
    double r;
    circle(point a, double b) {
        p = a;
        r = b;
    }
    //circle(point a, double b) : p(a), r(b) {}; //no error
};

An error message saying "No default constructor exists for class point" appeared in circle constructor. Why default constructor for point is needed?

xinaiz
  • 7,744
  • 6
  • 34
  • 78
e.r
  • 11
  • 1

0 Answers0