Зміст курсу
C# Beyond Basics
C# Beyond Basics
Practicing Polymorphism
The program given below contains a superclass called Shape
and three derived classes called Rectangle
, Square
and Circle
. The problem with the code is that the methods are not properly overridden since the output shows 0.0
for all the three Console.WriteLine
statements which implies that the methods of the base class are being executed instead of the derived class' methods.
Edit the code in such a way that the two methods, namely getArea
and calculatePerimeter
are correctly overridden.
index
Все було зрозуміло?