Chapter at a glance
This chapter introduces Object-Oriented Programming (OOP) as a programming paradigm that structures code around objects. It covers the fundamental concepts of OOP, including classes, objects, inheritance, polymorphism, encapsulation, and abstraction, and contrasts OOP with procedural programming.
- Object-Oriented Programming (OOP)
- Procedural Programming
- Class
- Object
- Inheritance
- Polymorphism
- Encapsulation
- Abstraction
Exam focus: Students should focus on understanding the four main pillars of OOP (Inheritance, Polymorphism, Encapsulation, Abstraction) and their practical implications, as well as the differences between OOP and procedural programming.
Key formulas and definitions
- Class: A blueprint or template for creating objects, defining attributes and methods.
- Object: An instance of a class, possessing state (data) and behavior (methods).
- Inheritance: A mechanism where a new class derives properties from an existing class.
- Polymorphism: The ability of a method or object to take on many forms (e.g., method overriding).
- Encapsulation: Bundling data and methods within a class and restricting direct access to data.
Solutions and answers
Multiple Choice Questions
In contrast, C++ (developed by Bjarne Stroustrup) is a superset of C that added full OOP support. PHP (from version 5+) supports classes and OOP features. Perl also supports OOP through packages and bless references.
• Ruby — A purely object-oriented language; everything in Ruby is an object, including numbers and strings.
• Python — A multi-paradigm language with strong OOP support; everything in Python is an object.
• C++ — Originally "C with Classes," it is a multi-paradigm language designed specifically to add OOP to C.
Since all three support OOP, the correct answer is "All of the above." True procedural languages include C, Pascal, FORTRAN, and BASIC.
For example, if Vehicle is a base class, then Car and Bike can be derived classes that inherit properties like
speed and color from Vehicle.
This means you write common functionality once in the base class and reuse it across multiple derived classes. This reduces code duplication, minimises bugs, and makes maintenance significantly easier. For instance, a Shape class might define
area() and perimeter(), which Circle, Rectangle, and Triangle all inherit and reuse.
For example, the class Student might define attributes like
name, roll_no, and grade. The class itself is abstract — it doesn't represent a specific student. When you create an object (instance) from the class, like student1 = Student("Ram", 101, "A"), that object represents a real, specific student.
For example, a base class Shape may define a method
area(). The derived classes Circle, Rectangle, and Triangle each override this method with their own formula — yet all are called using the same method name area(). This is polymorphism in action: "one name, many forms."
Short Answer Questions
Different paradigms offer different philosophies for structuring code. Some programs are best written as a sequence of step-by-step instructions (procedural), while others benefit from modelling real-world entities as objects (OOP).
- Follows a top-down approach — program is divided into procedures/functions
- Focuses on functions and procedures that operate on data
- Data and functions are separate entities
- Less secure — no access control mechanism
- Difficult to manage for large, complex projects
- Examples: C, Pascal, FORTRAN
- Follows a bottom-up approach — program is built around objects
- Focuses on objects that combine data and behaviour
- Data and functions are bundled together in objects
- More secure — supports encapsulation and access modifiers
- Easier to manage and scale for complex projects
- Examples: C++, Java, Python
In OOP, a program is viewed as a collection of objects that communicate with one another. Each object is an instance of a class, which serves as a blueprint defining the structure and behaviour of its objects.
- Code Reusability — Through inheritance, existing code can be reused in new classes without rewriting, saving development time and effort.
- Data Security (Encapsulation) — Data hiding is achieved through encapsulation, where internal object details are protected from outside interference using access modifiers.
- Modularity — The source code for an object can be written and maintained independently of other objects, making debugging and collaborative development easier.
- Easier Maintenance and Upgradation — OOP systems are easier to maintain, modify, and extend because changes in one part of the system have minimal impact on other parts.
- Polymorphism and Flexibility — The same interface can be used for different data types and behaviours, making the code more flexible and adaptable.
- Better Problem Modelling — OOP mirrors real-world entities and their interactions, making it intuitive to design and understand complex systems.
- Improved Productivity — Reusability, modularity, and cleaner design lead to faster development and higher-quality software.
Object-Oriented Programming has four fundamental features (also called the four pillars of OOP) along with several other important concepts:
- Class — A class is a user-defined blueprint or prototype from which objects are created. It defines a set of attributes and methods that characterize any object of the class. For example, Student is a class, and individual students are objects.
- Object — An object is an instance of a class. It is a real-world entity that has state (data/attributes) and behaviour (methods/functions). For example, a specific student named "Ram" with roll number 101 is an object of the Student class.
- Inheritance — Inheritance is the mechanism by which one class (child/derived) acquires the properties and behaviours of another class (parent/base). It promotes code reusability and establishes an "is-a" relationship. For example, Car is a Vehicle.
- Polymorphism — Polymorphism means "many forms." It allows the same method name to perform different tasks depending on the object that calls it. This is achieved through method overloading (compile-time) and method overriding (runtime).
- Encapsulation — Encapsulation is the wrapping of data (variables) and code (methods) together into a single unit (class). It also provides data hiding by restricting direct access to some components using access modifiers (private, protected, public).
- Abstraction — Abstraction means hiding the internal implementation details and showing only the essential features. It is achieved through abstract classes and interfaces. For example, when you drive a car, you only use the steering wheel and pedals — you don't need to know how the engine works internally.
- Message Passing — In OOP, objects communicate with each other by sending and receiving messages (i.e., calling methods on objects). This mechanism of interaction between objects is called message passing.
Polymorphism is broadly classified into two types:
- Compile-time Polymorphism (Static Binding) — Achieved through method overloading (multiple methods with the same name but different parameters in the same class) and operator overloading. The compiler determines which method to call at compile time.
- Run-time Polymorphism (Dynamic Binding) — Achieved through method overriding (a derived class provides its own implementation of a method defined in the base class). The correct method is determined at runtime based on the object type.
Key aspects of inheritance:
- Promotes Code Reusability — Common code is written once in the base class and inherited by all derived classes, eliminating redundancy.
- Establishes "Is-A" Relationship — For example, Dog is a Animal, Car is a Vehicle.
- Types of Inheritance — Single (one parent, one child), Multiple (multiple parents, one child), Multilevel (grandparent → parent → child), Hierarchical (one parent, multiple children), and Hybrid (combination of types).
-
The
super()keyword is used to call the parent class constructor or methods from the derived class.
Object-Oriented Programming is widely used across many domains of software development due to its modularity, reusability, and scalability. The major applications of OOP are:
OOP languages like Java, C++, Python, C#, and Swift are the backbone of most modern software systems. The ability to model real-world entities, reuse code through inheritance, and secure data through encapsulation makes OOP the preferred paradigm for complex, large-scale softwareThe request was rejected because it was considered high risk
Frequently asked questions
What is Object-oriented programming (OOP) about?
This chapter introduces Object-Oriented Programming (OOP) as a programming paradigm that structures code around objects. It covers the fundamental concepts of OOP, including classes, objects, inheritance, polymorphism, encapsulation, and abstraction, and contrasts OOP with procedural programming.
Which topics are covered in Object-oriented programming (OOP)?
Class 12 Computer Science “Object-oriented programming (OOP)” covers: Object-Oriented Programming (OOP); Procedural Programming; Class; Object; Inheritance; Polymorphism; Encapsulation; Abstraction.
What should I focus on in Object-oriented programming (OOP) for the exam?
Students should focus on understanding the four main pillars of OOP (Inheritance, Polymorphism, Encapsulation, Abstraction) and their practical implications, as well as the differences between OOP and procedural programming.
What are the key formulas or definitions in Object-oriented programming (OOP)?
Class: A blueprint or template for creating objects, defining attributes and methods.; Object: An instance of a class, possessing state (data) and behavior (methods).; Inheritance: A mechanism where a new class derives properties from an existing class.; Polymorphism: The ability of a method or object to take on many forms (e.g., method overriding).; Encapsulation: Bundling data and methods within a class and restricting direct access to data..
Where can I read the Class 12 Computer Science “Object-oriented programming (OOP)” solutions?
Right on this page. They are free and you do not need to sign up. For chapter quizzes and the AI tutor, install the Sikshya Plus app.
Study tips
Do not just read it. Practice it.
You have read the solutions for Object-oriented programming (OOP). Now test yourself, ask the AI tutor and keep your streak going.




- AI quizzes for this chapterTest yourself with instant feedback and explanations after every answer.
- AI tutor, free, 24/7Stuck on a question? Ask in your own words and get a step-by-step explanation.
- 14 AI tools in one appSummarizer, grammar checker, flashcards, essay help, math solver and more.
- Past questions and notesPast papers and your own notes organized chapter by chapter.