so that I can understand it properly?
OOP Human brains have limited abilities, only about 7+-2 items we can have in mind at the same time. Basic idea of OOP is to help human to understand the code by dividing the code into small encapsulated pieces (that can be understood separately) and then connect them in various ways (by creating bigger but still encapsulated pieces) to achieve the goal of the application. These pieces are classes. That's the concept in a few words.
Woah..that was great..thanks a lot.
And what are objects?
Objects are instances of classes. E.g. you're making a simple videogame and have an Enemy class that describes what is an enemy, what properties and functionality it has; then you can create e.g. enemy1 and enemy2 that are two objects of Enemy class that have different values of these properties (e.g. different coordinates, different health values) So class is a description defined at compile time, objects are real-time instances of classes.
Обсуждают сегодня