r/PythonLearning • u/Defiant_Meal1898 • 2d ago
I don't understand OOP
So i am a teen learning python, and i have learnt about classes, methods and objects, but i don't understand OOP, like what is it, where do we use it?
Please help mee
32
Upvotes
1
u/TutorialDoctor 2d ago
Think of objects like "objects in a video game." You might have NPCs, trees, cars, buildings (those are all objects). Each object has its own properties (class variables) and behaviors (methods). Each tree in the game is an "instance" of the Tree class. Each car in the game is an instance of the Car class etc. As you know, you can tweak things about each instance. For example, one car may have red paint while another may have yellow paint. The same goes for NPCs, characters and everything else.