Solution: Create a Hierarchy of Inheritance
Look at the solution to the previous challenge.
We'll cover the following
Problem statement
Explore inheritance hierarchies by following these steps:
Create a class named
Shape
with properties namedHeight
,Width
, andArea
.Add three classes that derive from it:
Rectangle
,Square
, andCircle
with any additional members you feel are appropriate and that override and implement theArea
property correctly.In
Program.cs
, add statements to create one instance of each shape, as shown in the following code:
Get hands-on with 1400+ tech skills courses.