Introduction to OOPs Concepts - Class 9 ICSE
Learning Objectives
By the end of this chapter, students will be able to:
- Understand the need for Object-Oriented Programming.
- Define important OOP concepts.
- Differentiate between procedural and object-oriented programming.
- Identify classes, objects, methods, and their uses.
1. What is Programming Paradigm?
A programming paradigm is a way or style of programming. There are mainly two types:
1. Procedural Programming (e.g., C, Pascal)
2. Object-Oriented Programming (OOP) (e.g., Java, C++)
2. Procedural vs Object-Oriented Programming
| Feature | Procedural Programming | Object-Oriented Programming |
|------------------|--------------------------|-------------------------------|
| Focus | Functions or procedures | Objects (data + methods) |
| Data | Shared globally | Encapsulated inside objects |
| Code Reusability | Less | High (through inheritance) |
| Example Language | C | Java |
3. What is Object-Oriented Programming?
Object-Oriented Programming (OOP) is a programming style where a program is built using objects that
interact with each other. Each object represents a real-world entity and contains data and methods.
4. Basic Concepts of OOP
Class: A blueprint or template to create objects.
Object: A real-world entity created using a class.
Encapsulation: Wrapping data and methods together in a single unit.
Introduction to OOPs Concepts - Class 9 ICSE
Abstraction: Hiding internal details and showing only the necessary features.
Inheritance: One class inherits the properties of another.
Polymorphism: One name, many forms (e.g., '+' for addition and string concatenation).
5. Components of a Class in Java
Example Java Code:
class Student {
String name;
int age;
void display() {
System.out.println("Name: " + name);
System.out.println("Age: " + age);
Creating and Using Objects:
public class Main {
public static void main(String[] args) {
Student s = new Student();
s.name = "Ravi";
s.age = 15;
s.display();
6. Key Terms Summary
Class - Blueprint for creating objects
Object - Instance of a class
Method - Function inside a class
Data Member - Variables in a class
Introduction to OOPs Concepts - Class 9 ICSE
Encapsulation - Binding of data and methods
Abstraction - Hiding internal details
Inheritance - Acquiring properties from another class
Polymorphism - One method/operator behaves differently
7. Practice Questions
A. Fill in the Blanks
1. A class is a __________ for creating objects.
2. In OOP, data is hidden using __________.
3. Java is based on the __________ programming paradigm.
B. True or False
1. An object is a blueprint of a class. (False)
2. Inheritance helps in code reuse. (True)
3. Encapsulation allows global access to data. (False)
C. Short Answer Questions
1. What is the difference between a class and an object?
2. Define encapsulation with an example.
3. Explain the term polymorphism with a real-life example.
Tips for Remembering
CAPIP - The 5 pillars of OOP:
C - Class
A - Abstraction
P - Polymorphism
I - Inheritance
P - Encapsulation
Think of everything as objects in real life. Eg: Pen, Car, Mobile - all have properties (data) and actions