parent
b1cec8c3bc
commit
e81c6eac3d
5 changed files with 59 additions and 5 deletions
@ -1 +1,8 @@ |
||||
# Inheritance |
||||
# Inheritance |
||||
|
||||
Inheritance is a fundamental concept in object-oriented programming (OOP) that allows a new class to inherit the properties and methods of an existing class. The class that is inherited from is called the parent or super class, while the class that inherits is called the child or sub class. Inheritance enables code reuse and allows for a hierarchical organization of classes, where a child class can inherit the properties and methods of its parent class and potentially add or override them. The main advantage of inheritance is that it allows for a clean and organized way to reuse code and share functionality among classes. |
||||
|
||||
Learn more from the following links: |
||||
|
||||
- [What is inheritance in programming?](https://www.youtube.com/watch?v=ajOYOxCanhE) |
||||
- [Overview of Inheritance (object-oriented programming)](https://en.wikipedia.org/wiki/Inheritance_(object-oriented_programming)) |
@ -1 +1,13 @@ |
||||
# Polymorphism |
||||
# Polymorphism |
||||
|
||||
Polymorphism is a concept in object-oriented programming (OOP) that allows objects of different classes to be treated as objects of a common parent class. This is achieved by defining a common interface for all classes that need to be treated polymorphically. The word polymorphism is derived from Greek, "poly" means many and "morph" means form. |
||||
|
||||
There are two types of polymorphism: |
||||
|
||||
- Compile-time polymorphism (also called static polymorphism or early binding) occurs when the type of the object that is going to be acted upon is determined at compile-time. This is achieved through method overloading, which allows multiple methods to have the same name but different parameters within the same class. |
||||
- Run-time polymorphism (also called dynamic polymorphism or late binding) occurs when the type of the object is determined at run-time. This is achieved through method overriding, which allows a child class to provide a specific implementation of a method that is already defined in its parent class. |
||||
|
||||
Learn more from the following links: |
||||
|
||||
- [Overview of Polymorphism in programming](https://www.bmc.com/blogs/polymorphism-programming/) |
||||
- [What is polymorphism in programming?](https://www.youtube.com/watch?v=tIWm3I_Zu7I) |
@ -1 +1,13 @@ |
||||
# Abstraction |
||||
# Abstraction |
||||
|
||||
Abstraction is a concept in object-oriented programming (OOP) that refers to the process of hiding the implementation details of an object and exposing only its essential features. It enables the use of objects without the need to understand the underlying complexity of their internal structure and behavior. |
||||
|
||||
There are two types of abstraction: |
||||
|
||||
- Data abstraction: refers to hiding the internal representation of data and providing a simplified view of the data through a set of well-defined interfaces. |
||||
- Behavioral abstraction: refers to hiding the internal behavior of an object and providing a simplified view of its capabilities through a set of well-defined interfaces. |
||||
|
||||
Learn more from the following links: |
||||
|
||||
- [What is Abstraction?](Abstraction) |
||||
- [Tutorial - Abstraction](https://www.youtube.com/watch?v=OF55HZPE7lQ) |
@ -1 +1,10 @@ |
||||
# Encapsulation |
||||
# Encapsulation |
||||
|
||||
Encapsulation is a concept in object-oriented programming (OOP) that refers to the practice of wrapping an object's internal data and behavior within a defined interface, and hiding the implementation details from the outside world. It is one of the fundamental concepts of OOP and is closely related to the concepts of data hiding and information hiding. |
||||
|
||||
Encapsulation is achieved by using access modifiers (such as "public," "private," and "protected") to control the visibility and accessibility of an object's data and methods. For example, data members of a class can be declared as private, which means they can only be accessed by methods within the class, while methods can be declared as public, which means they can be called by any code that has a reference to the object. |
||||
|
||||
Learn more from the following links: |
||||
|
||||
- [Overview of Encapsulation](https://en.wikipedia.org/wiki/Encapsulation_(computer_programming)) |
||||
- [Tutorial - What is encapsulation in programming?](https://www.youtube.com/watch?v=sNKKxc4QHqA) |
@ -1 +1,15 @@ |
||||
# Primary principles |
||||
# Primary Principles |
||||
|
||||
There are several primary principles that are considered fundamental to object-oriented programming (OOP). These principles include: |
||||
|
||||
- Encapsulation: The practice of wrapping an object's internal data and behavior within a defined interface, and hiding the implementation details from the outside world. |
||||
- Inheritance: The ability of a new class to inherit the properties and methods of an existing class, enabling code reuse and allowing for a hierarchical organization of classes. |
||||
- Polymorphism: The ability of objects of different classes to be treated as objects of a common parent class, allowing code to be written in a more general and flexible way. |
||||
- Abstraction: The process of hiding the implementation details of an object and exposing only its essential features, reducing complexity and improving the modularity of the code. |
||||
- Classes: The blueprint for creating objects, which have both data (attributes) and behavior (methods). |
||||
- Objects: Instances of a class, which have their own unique state and behavior. |
||||
|
||||
Learn more from the following links: |
||||
|
||||
- [Principles of Object-Oriented Programming](https://khalilstemmler.com/articles/object-oriented/programming/4-principles/) |
||||
- [What are four basic principles of OOP?](https://medium.com/@cancerian0684/what-are-four-basic-principles-of-object-oriented-programming-645af8b43727) |
Loading…
Reference in new issue