I have a task where I need to do a well-projected hierarchy for classes of different geometric figures:
- circle
- circumference
- ring
- rectangle
- triangle
- etc.
At first, I made an abstract class Figure
as follows:
abstract class Figure
{
public abstract double Area { get; }
public abstract double GetArea();
}
I planned that every other class that describes a particular figure will be an inheritor of the Figure
one. And the idea of the Area
in the Figure
works right before the moment when I understand that Circumference
has no Area
.
And I can't decide what to do next: describe another abstract class AbstractCircle
, delete this Area
property and method from the Figure
or just set Area = 0
in the Circumference
. Or maybe just make the Circumference
to be an inheritor of the Circle
and then set Area = 0
?
Is it logically correct? I mean, would this logic be understandable for people who will read this program?
I will be glad to see the tips and comments.