Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Practicing Polymorphism | OOP Principles
C# Beyond Basics
course content

Зміст курсу

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.

cs

index

Все було зрозуміло?

Секція 5. Розділ 5
We're sorry to hear that something went wrong. What happened?
some-alt