Question
What is Object Oriented Programming (OOP)? Explain the four fundamental principles of OOP, namely, Encapsulation, Abstraction, Inheritance, and Polymorphism with suitable examples
Answer :
Word Count : 1223
_________ ________ _________ ____ __________.
___ _________ _____ _______ ________.
______ ________ _____ _________ _______ ________ _____ _______ ________ ______ ________ _______.
___ _____ ____ _________ ________ __________ _________ __________ ___ ______ ________ ____.
_______ ____ _____ _______ __________.
_____ __________ ___ ______ __________ ________ _______ ________.
_______ _______ ________ ___ _________.
________ ________ _________ ___ _________ ___ _______ _________ _______ __________.
__________ _________ _____ _____ _____ ______ ___.
______ ____ ___ ______ ______.
____ ______ ____ ___ ________ _____ _______.
__________ ___ ________ __________ ____ ____ ___ _________ ________.
_______ ________ __________ _______ _____ _________ _________ _______.
____ ___ ________ _________ __________ _________ _______ __________ ____ __________.
____ ____ ___ __________ _______ ___.
______ _________ _____ _________ _______ __________ _____ _____ ________ __________ ____ ________.
_____ ______ _____ ____ ____ ________ ________ ______ _______ ________ ____.
_____ ____ ______ ___ _______.
__________ ________ _____ __________ _______ __________ __________ ______ __________ ____.
_______ __________ _______ __________ ______ ______ _________ ___ _____.
___ _____ _____ ________ _____.
_________ ____ ________ _________ ________ ____ ___.
________ _______ ________ ______ ________ _________.
_____ _____ ___ __________ __________ ____ __________ ________.
________ _________ ______ _____ ___ _________ ________ _______ _________ ______ __________.
___ _______ ___ ______ ____ __________ ________ __________.
______ ______ __________ ________ _____ _____ ______ _______ _______ ______ _______.
_________ ___ ________ ________ ___ ______.
________ ___ ____ _________ _______ _________ ___ ______ ________.
________ _______ _______ ___ ___ ___ __________ ___ _________ ________.
__________ _________ _____ _________ _________ ____ _______ _______.
________ __________ __________ ____ _______ ____ ______ _______ _______.
______ _______ ______ ________ _______ _____ ______ _____.
__________ ____ __________ ________ ________ ___ __________ _________ __________ ___.
_________ ____ _________ _________ _______ _________ _______ ________.
_______ _______ ______ _____ ____ _______ __________ ________.
_________ _______ ________ ________ __________ _________ ___.
______ __________ _________ __________ __________ _____ ________ ______ __________.
_________ ___ _________ __________ ________ ____ ________ ___.
_______ _______ ______ _____ _____ _____ ________.
____ __________ ____ __________ _______ _____ _____ __________.
_______ ___ _______ ___ _________.
_________ _____ _______ _________ ___ ______ ___ ____ _____ _______ ________ _________.
___ ___ ______ ________ ___ _________.
___ _________ ________ ___ _________ ___ _____ ____ ______ ______ ___.
______ ______ __________ __________ _________.
______ _________ ________ _________ ____ ____ ___ _____ _______ ____.
______ ____ ______ ____ _____.
_____ _______ __________ ______ _______ ______ ___ _______.
__________ ______ ________ ____ __________ ____ ____ _________.
_______ ____ __________ ______ ___ _____ _____ __________ _________ _______ ________ _______.
________ __________ __________ ______ ____ ______ _____ __________.
_____ _______ ___ __________ ______ __________ _________.
______ ________ ___ __________ ___ ____ ____ ________.
______ __________ _________ ______ _____ ___ ____ _______ _____ ________.
______ _________ _________ _____ __________ __________ _____ __________ ____ ______.
___ __________ ___ ____ _________ ___.
________ ___ __________ _________ _________ _________ _______ ___.
_________ ______ ________ _____ _____.
________ ___ ________ _____ ___.
_____ ____ ____ ___ _________ _________ ___ ____ __________ _________ ______ ____.
________ ______ ________ __________ ____ ______ ______ ________ __________.
_________ _________ _________ _____ _______ ______ __________.
___ ______ _________ ___ _________ _____ ___ _________.
_________ _____ ________ ______ ___ ____.
____ ______ ___ _____ ___ _____ _____.
_____ ________ _______ ______ ____ ____ ___ __________ _________ ___ ________ ____.
________ _______ ________ ___ __________ ___ ________ ____ __________.
_______ _________ ______ ________ ______ ________ ________ ________ _________.
____ ___ _____ _____ ___.
____ ______ ___ _________ _______ _____ ________ _________.
______ ______ ____ ____ ___.
_____ ___ ________ _________ ______ __________ ________ ___ __________ ______ ______ _____.
________ _________ ___ _______ _______ _______ _________ ___ ____ __________ __________.
________ _________ _______ ____ _____.
_______ _______ __________ _______ _______ _____.
____ _____ __________ ____ _______ _____ __________ __________ ______ __________ _____.
__________ _________ ____ _______ ___.
_____ ___ _________ ____ _________ ___ ________.
__________ ______ __________ ________ _____ ________ _____ ____ ___ ___ ______ ___.
__________ ________ ___ ____ _________ ____ ___ _______ ___ ________.
_________ _____ _________ _________ ________ ____ ____ ______ _______ _______.
___ _____ ____ __________ _________ ____ ___.
______ _____ _____ ___ _____ __________ _____ _____.
___ ___ ______ ______ __________ ______ _________ ______ ___ _______ ____ __________.
____ _________ _________ _______ ___ _____ _________.
_______ ___ ___ _______ ___.
_____ ___ __________ ____ ____ ______ _________.
________ ______ ___ ______ _______.
______ ___ ______ ______ ______ ________ __________ _______ __________ ________ ________ ________.
_______ _________ __________ _____ __________ ____ ___ _________ __________ ___ _______.
__________ _________ _____ ____ _______ _______ ____ ____ __________.
________ ________ _________ _________ __________ _________ __________ __________.
_______ __________ _____ ________ ___ ________ ________ ______ ___ __________ ___ _________.
_______ ________ __________ _________ ___ __________ _____ _______ ___ ___ ___ ______.
________ _______ ___ ______ _________ _________ ________.
Skip in 10
# Object Oriented Programming (OOP) Object Oriented Programming (OOP) is a programming paradigm in which a software system is designed around objects rather than only around functions and procedures. An object represents a real-world or conceptual entity and contains both data and the operations that can be performed on that data. OOP helps programmers develop software that is modular, reusable, secure, maintainable, and easier to understand. Languages such as Java, C++, C#, and Python support object-oriented programming. Java is fundamentally object-oriented and provides strong support for the major concepts of OOP through classes, objects, methods, access modifiers, inheritance, interfaces, and method overriding. A class is a blueprint or template from which objects are created. It defines the properties and behaviours that its objects will possess. For example, a `Student` class may contain data members such as `name`, `rollNo`, and `marks`, together with methods such as `displayDetails()` and `calculateGrade()`. An object is an actual instance of a class. Thus, `Student s1 = new Student();` creates an object `s1` of the `Student` class. The four fundamental principles of OOP are Encapsulation, Abstraction, Inheritance, and Polymorphism. Encapsulation is the process of combining data and the methods that operate on that data into a single unit, generally a class, while restricting direct access to the internal data. It is an important mechanism for data protection and information hiding. In Java, encapsulation is commonly achieved by declaring data members as `private` and providing public getter and setter methods to access or modify them in a controlled manner. For example: ```java class BankAccount { private double balance; public void deposit(double amount) { if (amount > 0) balance += amount; } public double getBalance() { return balance; } } ``` In this example, `balance` is declared `private`, so it cannot be directly modified from outside the class. The `deposit()` method controls how money is added to the account, while `getBalance()` provides controlled access to the balance. A statement such as `account.balance = -5000;` is not permitted because the variable is private. Encapsulation therefore protects the object's state and prevents unauthorized or inappropriate modification. It also improves maintainability because changes to the internal implementation can be made without affecting the external code that uses the class. Abstraction means representing only the essential features of an object while hiding unnecessary implementation details. It allows a programmer to concentrate on what an object does rather than how it does it. In Java, abstraction can be implemented mainly through abstract classes and interfaces. For example: ```java abstract class Shape { abstract void draw(); } class Circle extends Shape {
__________ ________ ________ ______ ____ ___._________ ________ _________ ____ __________.
___ _________ _____ _______ ________.
______ ________ _____ _________ _______ ________ _____ _______ ________ ______ ________ _______.
___ _____ ____ _________ ________ __________ _________ __________ ___ ______ ________ ____.
_______ ____ _____ _______ __________.
_____ __________ ___ ______ __________ ________ _______ ________.
_______ _______ ________ ___ _________.
________ ________ _________ ___ _________ ___ _______ _________ _______ __________.
__________ _________ _____ _____ _____ ______ ___.
______ ____ ___ ______ ______.
____ ______ ____ ___ ________ _____ _______.
__________ ___ ________ __________ ____ ____ ___ _________ ________.
_______ ________ __________ _______ _____ _________ _________ _______.
____ ___ ________ _________ __________ _________ _______ __________ ____ __________.
____ ____ ___ __________ _______ ___.
______ _________ _____ _________ _______ __________ _____ _____ ________ __________ ____ ________.
_____ ______ _____ ____ ____ ________ ________ ______ _______ ________ ____.
_____ ____ ______ ___ _______.
__________ ________ _____ __________ _______ __________ __________ ______ __________ ____.
_______ __________ _______ __________ ______ ______ _________ ___ _____.
___ _____ _____ ________ _____.
_________ ____ ________ _________ ________ ____ ___.
________ _______ ________ ______ ________ _________.
_____ _____ ___ __________ __________ ____ __________ ________.
________ _________ ______ _____ ___ _________ ________ _______ _________ ______ __________.
___ _______ ___ ______ ____ __________ ________ __________.
______ ______ __________ ________ _____ _____ ______ _______ _______ ______ _______.
_________ ___ ________ ________ ___ ______.
________ ___ ____ _________ _______ _________ ___ ______ ________.
________ _______ _______ ___ ___ ___ __________ ___ _________ ________.
__________ _________ _____ _________ _________ ____ _______ _______.
________ __________ __________ ____ _______ ____ ______ _______ _______.
______ _______ ______ ________ _______ _____ ______ _____.
__________ ____ __________ ________ ________ ___ __________ _________ __________ ___.
_________ ____ _________ _________ _______ _________ _______ ________.
_______ _______ ______ _____ ____ _______ __________ ________.
_________ _______ ________ ________ __________ _________ ___.
______ __________ _________ __________ __________ _____ ________ ______ __________.
_________ ___ _________ __________ ________ ____ ________ ___.
_______ _______ ______ _____ _____ _____ ________.
____ __________ ____ __________ _______ _____ _____ __________.
_______ ___ _______ ___ _________.
_________ _____ _______ _________ ___ ______ ___ ____ _____ _______ ________ _________.
___ ___ ______ ________ ___ _________.
___ _________ ________ ___ _________ ___ _____ ____ ______ ______ ___.
______ ______ __________ __________ _________.
______ _________ ________ _________ ____ ____ ___ _____ _______ ____.
______ ____ ______ ____ _____.
_____ _______ __________ ______ _______ ______ ___ _______.
__________ ______ ________ ____ __________ ____ ____ _________.
_______ ____ __________ ______ ___ _____ _____ __________ _________ _______ ________ _______.
________ __________ __________ ______ ____ ______ _____ __________.
_____ _______ ___ __________ ______ __________ _________.
______ ________ ___ __________ ___ ____ ____ ________.
______ __________ _________ ______ _____ ___ ____ _______ _____ ________.
______ _________ _________ _____ __________ __________ _____ __________ ____ ______.
___ __________ ___ ____ _________ ___.
________ ___ __________ _________ _________ _________ _______ ___.
_________ ______ ________ _____ _____.
________ ___ ________ _____ ___.
_____ ____ ____ ___ _________ _________ ___ ____ __________ _________ ______ ____.
________ ______ ________ __________ ____ ______ ______ ________ __________.
_________ _________ _________ _____ _______ ______ __________.
___ ______ _________ ___ _________ _____ ___ _________.
_________ _____ ________ ______ ___ ____.
____ ______ ___ _____ ___ _____ _____.
_____ ________ _______ ______ ____ ____ ___ __________ _________ ___ ________ ____.
________ _______ ________ ___ __________ ___ ________ ____ __________.
_______ _________ ______ ________ ______ ________ ________ ________ _________.
____ ___ _____ _____ ___.
____ ______ ___ _________ _______ _____ ________ _________.
______ ______ ____ ____ ___.
_____ ___ ________ _________ ______ __________ ________ ___ __________ ______ ______ _____.
________ _________ ___ _______ _______ _______ _________ ___ ____ __________ __________.
________ _________ _______ ____ _____.
_______ _______ __________ _______ _______ _____.
____ _____ __________ ____ _______ _____ __________ __________ ______ __________ _____.
__________ _________ ____ _______ ___.
_____ ___ _________ ____ _________ ___ ________.
__________ ______ __________ ________ _____ ________ _____ ____ ___ ___ ______ ___.
__________ ________ ___ ____ _________ ____ ___ _______ ___ ________.
_________ _____ _________ _________ ________ ____ ____ ______ _______ _______.
___ _____ ____ __________ _________ ____ ___.
______ _____ _____ ___ _____ __________ _____ _____.
___ ___ ______ ______ __________ ______ _________ ______ ___ _______ ____ __________.
____ _________ _________ _______ ___ _____ _________.
_______ ___ ___ _______ ___.
_____ ___ __________ ____ ____ ______ _________.
________ ______ ___ ______ _______.
______ ___ ______ ______ ______ ________ __________ _______ __________ ________ ________ ________.
_______ _________ __________ _____ __________ ____ ___ _________ __________ ___ _______.
__________ _________ _____ ____ _______ _______ ____ ____ __________.
________ ________ _________ _________ __________ _________ __________ __________.
_______ __________ _____ ________ ___ ________ ________ ______ ___ __________ ___ _________.
_______ ________ __________ _________ ___ __________ _____ _______ ___ ___ ___ ______.
________ _______ ___ ______ _________ _________ ________.
IGNOU ACADEMY
Your IGNOU journey, made easier.
- Solved Assignments
- Study Notes
- Guess Papers
- Question Papers
Continue Reading — It's Free
Sign in with Google to unlock more of this answer.
✓ Free access
✓ Unlock up to 60% of the answer
✓ No payment required
✓ Unlock up to 60% of the answer
✓ No payment required
Quick Google sign-in. No separate registration form.