A circle defined by its radius. More...
#include <shapes.hpp>
Public Member Functions | |
| Circle (double radius) | |
| Construct a circle with the given radius. | |
| double | area () const override |
| Compute the area of the shape. | |
| std::string | name () const override |
| Return the human-readable name of the shape. | |
| double | perimeter () const override |
| Compute the perimeter of the shape. | |
| double | radius () const |
| Get the radius. | |
Public Member Functions inherited from geometry::Shape | |
| virtual | ~Shape ()=default |
| Virtual destructor for safe polymorphic deletion. | |
| std::string | describe () const |
| Pretty-print shape information. | |
Additional Inherited Members | |
Static Public Member Functions inherited from geometry::Shape | |
| static int | instance_count () |
| Get the total count of Shape instances created. | |
Protected Member Functions inherited from geometry::Shape | |
| Shape () | |
| Increment the instance counter. | |
A circle defined by its radius.
Area and perimeter are computed as:
\[ A = \pi r^2, \qquad P = 2\pi r \]
Definition at line 103 of file shapes.hpp.
|
inlineexplicit |
Construct a circle with the given radius.
| radius | The radius (must be positive). |
Definition at line 110 of file shapes.hpp.
References radius().
|
inlinenodiscardoverridevirtual |
Compute the area of the shape.
Implements geometry::Shape.
Definition at line 112 of file shapes.hpp.
|
inlinenodiscardoverridevirtual |
Return the human-readable name of the shape.
"Circle", "Rectangle", etc. Implements geometry::Shape.
Definition at line 120 of file shapes.hpp.
|
inlinenodiscardoverridevirtual |
Compute the perimeter of the shape.
Implements geometry::Shape.
Definition at line 116 of file shapes.hpp.
|
inlinenodiscard |
Get the radius.
Definition at line 123 of file shapes.hpp.
Referenced by Circle().