OOPS
oops stands for object oriented programming synopsis
object oriented programming in javascript:
------------------------------------------
*object oriented programming is based on following
things:
1.Encapsulation
2.Abstraction
3.Inheritance
4.Polymorphism
Before object oriented programming we had procedural programming that divide a program into set of functions so we hava data stored in a bunch of variables and functions that operate on data this style of programming is simple and straight forward.
Ex:C language is a procedural Programming language.
1.Encapsulation
binding|combining related variables and
functions as one unit
practicle:
class implements data encapsulation
2.Abstraction
hiding important|secured data is called
data abstraction,showing|exposing only necessary
things
practicle:
object creation,object will expose only
public things,private things will be hidden
user----->object------>class
| | |
only b a private+public
will be b a b
visible [memory]
3.Inheritance
creating new entity[class] based on
existing entity is called "inheritance"
this provides reusability
class: 1.parent class 2.child class
4.Polymorphsim-->poly + morphism
| |
many forms
many forms of a single entity|object is called
polymorphism
practicle:
methodoverloading
method overriding
Method overloading:Method overloading allows a class to define multiple methods with the same name but different signature.
Method overridding:In oop programming language, Overridding is a feauture that allows a subclass or child class to provide a specific implementation of method that is already provided by the super class or parent class.