So I have my Rectangle class and Shape class. In shape class I wrote constructor and I got this error from VS "The default constructor cannot be referenced error".
Here is my code:
Here is my code:
Code:
class Rectangle {
private:
sf::RectangleShape rectangleshape;
public:
Rectangle() = default;
Rectangle(float width, float height) : rectangleshape(sf::RectangleShape(sf::Vector2f(width, height))) {}
void setPosition(float position_x, float position_y) {
rectangleshape.setPosition(position_x, position_y);
}
void setAngle(float angle) {
rectangleshape.setRotation(angle);
}
sf::RectangleShape* getRectangleShape() {
return &rectangleshape;
}
Position getPosition() {
return Position(rectangleshape.getPosition().x, rectangleshape.getPosition().y);
}
};
class Shape {
private:
Shape_Type type;
Rectangle rectangle;
Circle circle;
public:
Shape() = default;
Shape(Rectangle shape_rectangle) { //ERROR IS HERE
type = RECTANGLE;
rectangle = shape_rectangle;
}
};