In object-oriented programming, polymorphism is a concept where a function behaves differently, depending on the type of object that calls it. To understand the concept of polymorphism, we will continue with the Shape class example. Every shape has its own type and dimensions, but all shapes can be drawn on the screen. When the Circle class calls the draw function, it calculates the area and draws it. Similarly, if the Triangle class calls the draw function, it calculates the base and height and draws it. The same applies to the other classes. The idea behind polymorphism is that the draw function can display different shapes and the program can determine which shape of the function to call at the time of execution. There are different types of polymorphism used in Kotlin. In this section, we are discussing inheritance-based polymorphism. The idea behind this is that...
United States
Great Britain
India
Germany
France
Canada
Russia
Spain
Brazil
Australia
Singapore
Hungary
Ukraine
Luxembourg
Estonia
Lithuania
South Korea
Turkey
Switzerland
Colombia
Taiwan
Chile
Norway
Ecuador
Indonesia
New Zealand
Cyprus
Denmark
Finland
Poland
Malta
Czechia
Austria
Sweden
Italy
Egypt
Belgium
Portugal
Slovenia
Ireland
Romania
Greece
Argentina
Netherlands
Bulgaria
Latvia
South Africa
Malaysia
Japan
Slovakia
Philippines
Mexico
Thailand