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
United Kingdom
India
Germany
France
Canada
Russia
Spain
Brazil
Australia
Argentina
Austria
Belgium
Bulgaria
Chile
Colombia
Cyprus
Czechia
Denmark
Ecuador
Egypt
Estonia
Finland
Greece
Hungary
Indonesia
Ireland
Italy
Japan
Latvia
Lithuania
Luxembourg
Malaysia
Malta
Mexico
Netherlands
New Zealand
Norway
Philippines
Poland
Portugal
Romania
Singapore
Slovakia
Slovenia
South Africa
South Korea
Sweden
Switzerland
Taiwan
Thailand
Turkey
Ukraine