As it's name describes, the concept revolves around the idea of objects and that of course means it has certain attributes and behaviours. For example if we have an blue bird object, it could have attributes such as colour and behaviours such as flying or eating which we can translate into methods. This is essentially the basic idea behind it and despite being so simple, it can accomplish many tasks. When we create a representation of an object, we call it a class and by doing this, we can instantiate an instance of a class (create the object) as many times as we want and if one of the created objects were modified, only the one specifically modified would be affected. This allows, for example in a zombie shooter game, there could be hundreds of zombies instantiated from the same zombie class but if the player were to shoot one zombie, only that zombie would be damaged while the others would remain unchanged.
However what truly makes object oriented programming shine is the process of inheritance which brings object oriented programming to its full potential. Similarly to how you inherit genetics from your parents, classes can do so too except that they inherit everything from their parents not just specific features. This allows us to group objects with similar features up, creating a hierarchy and preventing a lot of repeated and unnecessary code from appearing.
For Example, if we were creating some hostile enemies in a game, our classes would look like:
Enemy (Parent):
Attributes: Health, Damage, Speed
Behaviour: Walk, Attack
Zombie (Subclass of Enemy):
Behaviour: Attack (Override), BadBreath
In the above example, we have a general parent class and then a more specific subclass. Our subclass which is called zombie, despite not having any new attributes attached to it not only inherited all the attributes of Enemy but its behaviour as well. As demonstrated, code is used more efficiently since we don't need to recopy any of our attributes that any Enemy should have into hostile creature classes that we make. Also we can even override methods from the parent class to make it fit the subclass more. For example an enemy could have an Attack method which simply damages targets at a range but clearly a zombie can't attack at a range (assuming he can only use his hands) and thus we can modify the Attack method and make it damage targets that are very close. Furthermore we could even add our own methods to our subclass such as BadBreath which can't be accessed by our parent class since in relation to children and parents, parents do not inherit genes from the children.
This makes object oriented programming one of the most useful tools in programming and when put together with inheritance, anything can be accomplished which is why I will be sure to try my best in honing my skills in this area.



