What is OOP?
Object Oriented Programming (OOP) represents real world things as programming objects. Each object bundles the data that describes it with the actions it can perform.
Key Idea: We model real world things as programming objects.
Every real thing, a car, a phone, a person, has characteristics (what it is) and behaviours (what it can do) at the same time. OOP keeps these two together inside one object instead of keeping data and logic separate.
Real World Object: Car
Example: CarA car has characteristics that describe it, and behaviours it can perform.
Characteristics
- Brand
- Model
- Year
- Color
- Max speed
- Gear type (automatic or manual)
Behaviours
- Drive
- Stop
- Self driving
- Parking
Real World Object: Human
Example: HumanA human breaks down into the same two categories.
Characteristics
- Name
- Birth year
- Nationality
- Gender
Behaviours
- Talk
- Run
- Swim
- Dance
A car and a human are completely different things, but both split into the same characteristics and behaviours. This is why OOP works as a general way to model almost anything: a book, a student, a bank account, a product.
Mapping the Real World into OOP
| Real World | OOP |
|---|---|
| Characteristics | Properties / Attributes |
| Behaviours | Methods |
Properties (also called attributes) are variables that store an object's data. Methods are functions that define what the object can do. This mapping is the same in every OOP language: Java, C++, Python, C#.
From Class to Object
Before a program can create a Car object, it needs a class. A class is the blueprint that lists which properties and methods a Car will have, it is not an actual car. From that class, the program can create one or more objects, each holding its own real values.
Car as an OOP Object
Example: Car ObjectA Car object built from the Car class holds real values for its properties and can run its methods.
Properties / Attributes
- make
- model
- year
- color
- maxSpeed
- gearType
Methods
- start()
- stop()
- drive()
- park()
Key Idea: Object = Properties + Methods. Properties describe the object. Methods define what it can do.
Exam Focus Points
- OOP represents real world things as objects, combining properties (state) and methods (behaviour).
- Characteristics become properties or attributes, behaviours become methods.
- A class is the plan; an object is the actual instance built from that plan.
Summary
- OOP represents real world things, like a car or a person, as programming objects.
- Every real world thing breaks down into characteristics and behaviours.
- Characteristics map to properties or attributes, behaviours map to methods.
- A class defines the structure; the object is the real instance created from it.
- Object = Properties + Methods.