Apa Perbedaan Polimorfisme dan inheritance? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Apa Perbedaan Polimorfisme dan inheritance?

12th Nov 2022, 7:36 AM
Rafby Saputra Mokodompit
Rafby Saputra Mokodompit - avatar
1 Answer
+ 3
Inheritance is one in which a new class is created that inherits the properties of the already exist class. It supports the concept of code reusability and reduces the length of the code in object-oriented programming. Types of Inheritance are: 1. Single inheritance 2. Multi-level inheritance 3. Multiple inheritance 4. Hybrid inheritance 5. Hierarchical inheritance. Polymorphism is that in which we can perform a task in multiple forms or ways. It is applied to the functions or methods. Polymorphism allows the object to decide which form of the function to implement at compile-time as well as run-time. Types of Polymorphism are: 1. Compile-time polymorphism (Method overloading) 2. Run-time polymorphism (Method Overriding) For more information: http://www.geeksforgeeks.org/difference-between-inheritance-and-polymorphism/amp/
12th Nov 2022, 11:14 PM
Mohammad Reza Farzam
Mohammad Reza Farzam - avatar