From this section we shall learn about the Object-Oriented Programming in JavaScript.
Object-Oriented Programming is a programming language.
The main features of Object-Oriented programming style are as follows,
An entity which has state, shape, behaviour, etc. are known as 'Object'.
NOTE: Most of the objects are nouns.
Examples: Computer, machine, TV, Pen, Watch, Rice, etc..
"Ramu went to buy a green pen"
In the above sentence Ramu & Pen (Noun's) are the objects, went & buy (Verb), black (Adjective)
Class
Collection of objects is known as 'Class'.
Binding code and data together into a single unit is known as 'Encaplsulation'.
Example: Chewing gum is wrapped with different tasty gel's inside.
Abstraction is nothing but hiding the internal details and showing the functionality.
Exapmle: Websites, internal code is hided and we can see the only output of the code.
Inheritance is nothing but acquring all the properties and behaviours of the parent object.
Example: Real life-object like humans, animals, birds, etc.
Performing one task in different ways is known as 'Polymorphism'.
Example: Drawing, Playing Games, Riding bike, etc..
To know more about Object-Oriented Programming, click here.