Understanding Class and Object in Python OOPs
What is a Class?
Understanding Class and Object in Python OOPs
What is a Class?
A Class is a blueprint or template used to create objects. It defines the properties (attributes) and behaviors (methods) that objects will have.
Real-World Example :
Think of a Car Showroom.
- The car design (blueprint) is the Class.
- It defines the model, color, engine, and features of the car.
Example :
class Car: pass
=> Here, Car is a Class.
What is an Object?
An Object is an instance of a class. It is a real-world entity created using a class.
Real-World Example :
From the Car class, you can create many objects such as:
- BMW
- Audi
- Tesla
Each car is an Object because it is created from the same class.
Example :
class Car: pass
car1 = Car() car2 = Car()
=> Here,
- car1 → Object
- car2 → Object
Both objects are created from the Car class.
Conclusion
A Class is a blueprint used to define the structure and behavior of objects, while an Object is a real instance created from that class. In OOPS, classes help organize code, and objects represent real-world entities that perform actions.
메타데이터
- post_id
- b897ca45f27a
- slug
- understanding-class-and-object-in-python-oops-b897ca45f27a
- url
- https://medium.com/@deevenayandagandi/understanding-class-and-object-in-python-oops-b897ca45f27a
- canonical_url
- https://medium.com/@deevenayandagandi/understanding-class-and-object-in-python-oops-b897ca45f27a
- author_url
- https://medium.com/@deevenayandagandi
- status
- ok
- fetched_at
- 2026-08-24 05:51:34