+ 1
What are concepts of object oriented programming??
please tell in basics I'm a starter.!
1 Respuesta
+ 2
For myself, I think of it like a blueprint for objects in our world, and it works best for me by thinking of it as actual physical objects. The blueprint (class) is the template that maps out and defines the object that we create from the blueprint (class). The blueprint (class) is the concept of the object, what it is and what it can do, but as the blueprint it's just the theory/template of it. When we instantiate (create) an object from a class, we're using the blueprint to create the actual object in the world so we can do what we want with it and manipulate it as we see fit. The cool thing about this is that once it is its own object, you can do what you want with it and if you need to you can create more of the original object from the blueprint at will. Each object is separate from one another so changes to one isn't going to affect the others. This handles a lot of otherwise redundant code.
As an example, you could have a class for 'animals.' It'll store the basic traits of what it represents, such as legs, name, fur color, etc... Then you can use that class to create multiple objects that represent differing individual animals. Rather than having to manually create each and every individual object for each animal, we created a blueprint for animals that we can use to create endless individual objects of it.