Задача: ShapesDetector
Компилятор: g++17 7.3 controlled
Вердикт: Ошибка при компиляции
Статус: contest.submits.status.wrong

#include <string>

enum class ShapeType {
    CIRCLE,
    ELLIPSE,
    SQUARE,
    RECTANGLE
};

class Shape {
public:
    virtual double area() = 0;
    virtual ShapeType GetShapeType() const = 0;
};

class Ellipse : public Shape {
public:
    double area() override;
    ShapeType GetShapeType() const override { return ShapeType::ELLIPSE; }
};

class Circle : public Ellipse {
public:
    double area() override;
    ShapeType GetShapeType() const override { return ShapeType::CIRCLE; }
};

class Rectangle : public Shape {
public:
    double area() override;
    ShapeType GetShapeType() const override { return ShapeType::RECTANGLE; }
};

class Square : public Rectangle {
public:
    double area() override;
    ShapeType GetShapeType() const override { return ShapeType::SQUARE; }
};

bool IsCircle(const Shape& shape) {
    return shape.GetShapeType() == ShapeType::CIRCLE;
}

bool IsEllipse(const Shape& shape) {
    return shape.GetShapeType() == ShapeType::ELLIPSE;
}

bool IsSquare(const Shape& shape) {
    return shape.GetShapeType() == ShapeType::SQUARE;
}

bool IsRectangle(const Shape& shape) {
    return shape.GetShapeType() == ShapeType::RECTANGLE;
}

stdout:


stderr:
__temp__.cpp:56:7: error: redefinition of ‘class Shape’
 class Shape {
       ^~~~~
__temp__.cpp:15:8: note: previous definition of ‘class Shape’
 struct Shape {
        ^~~~~
__temp__.cpp:62:7: error: redefinition of ‘class Ellipse’
 class Ellipse : public Shape {
       ^~~~~~~
__temp__.cpp:19:8: note: previous definition of ‘class Ellipse’
 struct Ellipse : public Shape {
        ^~~~~~~
__temp__.cpp:68:7: error: redefinition of ‘class Circle’
 class Circle : public Ellipse {
       ^~~~~~
__temp__.cpp:27:8: note: previous definition of ‘class Circle’
 struct Circle : public Ellipse {
        ^~~~~~
__temp__.cpp:74:7: error: redefinition of ‘class Rectangle’
 class Rectangle : public Shape {
       ^~~~~~~~~
__temp__.cpp:33:8: note: previous definition of ‘class Rectangle’
 struct Rectangle : public Shape {
        ^~~~~~~~~
__temp__.cpp:80:7: error: redefinition of ‘class Square’
 class Square : public Rectangle {
       ^~~~~~
__temp__.cpp:41:8: note: previous definition of ‘class Square’
 struct Square : public Rectangle {
        ^~~~~~
__temp__.cpp: In function ‘bool IsCircle(const Shape&)’:
__temp__.cpp:87:18: error: ‘const class Shape’ has no member named ‘GetShapeType’
     return shape.GetShapeType() == ShapeType::CIRCLE;
                  ^~~~~~~~~~~~
__temp__.cpp: In function ‘bool IsEllipse(const Shape&)’:
__temp__.cpp:91:18: error: ‘const class Shape’ has no member named ‘GetShapeType’
     return shape.GetShapeType() == ShapeType::ELLIPSE;
                  ^~~~~~~~~~~~
__temp__.cpp: In function ‘bool IsSquare(const Shape&)’:
__temp__.cpp:95:18: error: ‘const class Shape’ has no member named ‘GetShapeType’
     return shape.GetShapeType() == ShapeType::SQUARE;
                  ^~~~~~~~~~~~
__temp__.cpp: In function ‘bool IsRectangle(const Shape&)’:
__temp__.cpp:99:18: error: ‘const class Shape’ has no member named ‘GetShapeType’
     return shape.GetShapeType() == ShapeType::RECTANGLE;
                  ^~~~~~~~~~~~