OOP is a preagmming paradigm based on the concept of objects.
Paradigm simply means the style of the code, how we write and orgnize cpde
Class is Like a blueprint from which we can creeate new objects based on the rules described in the class
The 4 fundamental principle of oop
Ignoring or hiding details that won't matter, allowing us to get an overview perspective of the thing we're implemenintg,instead of messing with details that don't really matter to our implementation.
Let's say we'ew implmeting a phone for a user to use, they don't need to know whtas going on inside phone, he have to use phone only
Basically means keeping properties and methods private inside the class, so they are not accesible from the outside the clss.
Prevents external code from accidentally manipulating internal properies or state
Child class extends parent class
.Making all properties and methods of a certain class avaiable to a child class, forming a hierarachical reletionship between classes.
Goal is to reuse logic that is comman to both of the classes
A child class can overwrire a method it inherited from a parent class
in simple child class can overwrite a method that is inherited from a parent class
Objects (instaces) are instantiated from a class,which functions like a blueprint.
this process of creating an instace is called instantiation
Objects are linked to a certain prototype object, so we say that each object has a prototype
the prototype object contains methods and properties that all the objects that are linked to that property can access and use.and this behavioue us useally called prototype inheritance.
so,the prototypal inheritance means that all objects that are linked to a certain prototype object can use the methods and properties that are defined on that prototype
/so bascailly, object inherit methods and propertires from the prototype which is the reason why this mechanim is called protypal inheriance
3 ways of imlemmeting prototypal inheriance in js
1) Constrctor functions
2) es6 classed