Unit 5: Object-Oriented Programming (OOP) (10 Hours)
5.1 Programming Paradigms: Procedural, Structural, and Object-Oriented
Programming paradigms are different styles or approaches to programming that dictate how solutions are formulated.
- Procedural Programming:
- Based on the concept of procedure calls.
 - Emphasizes functions or procedures to operate on data.
 - Example languages: C, Pascal.
 - Advantages: Simplicity and ease of understanding; good for small programs.
 
 - Structural Programming:
- An extension of procedural programming.
 - Focuses on improving the clarity and efficiency of code by using structures (such as control flow structures).
 - Encourages breaking programs into smaller, manageable pieces.
 - Example languages: C, Ada.
 
 - Object-Oriented Programming:
- Organizes software design around data (objects) rather than functions and logic.
 - Promotes concepts such as encapsulation, inheritance, and polymorphism.
 - Example languages: C++, Python.
 - Advantages: Improved code reusability, scalability, and maintainability.
 
 
5.2 Features of OOP: Class, Object, Polymorphism, and Inheritance
OOP is characterized by several key features:
Class:
- A blueprint for creating objects.
 - Encapsulates data for the object and methods to manipulate that data.
 - Example in C++:
 
Object:
- An instance of a class.
 - Contains real values instead of variables.
 - Example:
 
Polymorphism:
- The ability to present the same interface for different data types.
 - Achieved through:
- Method Overloading: Multiple functions with the same name but different parameters.
 - Method Overriding: A derived class provides a specific implementation of a method already defined in its base class.
 
 - Method Overloading: Multiple functions with the same name but different parameters.
 
Inheritance:
- Mechanism by which one class (derived class) can inherit the attributes and methods of another class (base class).
 - Types of inheritance:
- Single Inheritance: One derived class inherits from one base class.
 - Multiple Inheritance: One derived class inherits from multiple base classes.
 - Multilevel Inheritance: A class is derived from another derived class.
 - Hierarchical Inheritance: Multiple classes are derived from the same base class.
 
 - Example:
 
5.3 Advantages of OOP
- Modularity: Code is organized into discrete classes and objects, enhancing clarity and organization.
 - Reusability: Classes and objects can be reused across different programs, saving time and effort.
 - Maintainability: Easier to update and maintain code due to modular design.
 - Abstraction: Hides complex implementation details and exposes only the necessary features to the user.
 - Inheritance: Facilitates code reuse and extension through derived classes.
 
5.4 Applications of OOP
OOP is widely used across various domains due to its flexibility and effectiveness. Some applications include:
- Software Development: Used in creating desktop applications, mobile apps, and web applications.
 - Game Development: Helps in modeling complex interactions between game objects.
 - Simulation and Modeling: Useful in scientific computing, simulations, and modeling real-world systems.
 - Database Management: Facilitates the design of object-oriented databases that model complex data relationships.