Similar questions have been answered but I still cannot find a solution to my problem. I am indeed not able to call the constructor of class Point inside class Rectangle. After having read some answers, I would approximately do it like this, but it does not work:
class Point {
public:
Point(int x, int y);
private:
int x;
int y;
};
Point::Point(int xx, int yy) {
x = xx;
y = yy;
}
class Rectangle {
public:
Rectangle(Point a, Point b) : Point(int x, int y); // this is wrong
private:
Point a;
Point b;
};
Rectangle::Rectangle(Point aa, Point bb) : Point(int x, int y) { // same as above
?
}
Can anyone help me to understand how to implement and fix this code (I know that declaring Rectangle as a struct makes it way easier)?