| 1 |
#pragma once |
| 2 |
|
| 3 |
/** |
| 4 |
* @brief Abstract base class for shapes. |
| 5 |
* |
| 6 |
* Provides a common interface for different types of shapes. |
| 7 |
*/ |
| 8 |
class Shape { |
| 9 |
public: |
| 10 |
/** |
| 11 |
* @brief Virtual destructor. |
| 12 |
*/ |
| 13 |
virtual ~Shape() {} |
| 14 |
|
| 15 |
/** |
| 16 |
* @brief Calculates the area of the shape. |
| 17 |
* |
| 18 |
* @return double The area of the shape. |
| 19 |
*/ |
| 20 |
virtual double area() const = 0; |
| 21 |
|
| 22 |
/** |
| 23 |
* @brief Calculates the perimeter of the shape. |
| 24 |
* |
| 25 |
* @return double The perimeter of the shape. |
| 26 |
*/ |
| 27 |
virtual double perimeter() const = 0; |
| 28 |
}; |
| 29 |
|
| 30 |
|