10. Object-Oriented Programming
10. Object-Oriented Programming
which can contain data and code to manipulate that data. The main characteristics of OOP are:
1. Encapsulation:
Bundling data (attributes) and methods (functions) that operate on the data into a single unit or class.
Helps in hiding the internal state of the object and only exposing a controlled interface.
2. Abstraction:
Allows the user to interact with objects at a higher level without needing to understand the underlying
code.
3. Inheritance:
Allows a class (child or derived class) to inherit properties and methods from another class (parent or
base class).
Allows objects to be treated as instances of their parent class rather than their actual class.
Includes method overloading (same method name with different parameters) and method overriding
(redefining a method in the derived class).
6. Message Passing:
Objects communicate with each other using messages (typically method calls).