brintos

brintos / llvm-project-archived public Read only

0
0
Text · 838 B · 8c6223a Raw
37 lines · c
1#pragma once2 3#include "Shape.h"4 5/**6 * @brief Rectangle class derived from Shape.7 *8 * Represents a rectangle with a given width and height.9 */10class Rectangle : public Shape {11public:12    /**13     * @brief Constructs a new Rectangle object.14     *15     * @param width Width of the rectangle.16     * @param height Height of the rectangle.17     */18    Rectangle(double width, double height);19 20    /**21     * @brief Calculates the area of the rectangle.22     *23     * @return double The area of the rectangle.24     */25    double area() const override;26 27    /**28     * @brief Calculates the perimeter of the rectangle.29     *30     * @return double The perimeter of the rectangle.31     */32    double perimeter() const override;33 34private:35    double width_; ///< Width of the rectangle.36    double height_; ///< Height of the rectangle.37};