- Object-oriented programming (OOP) is a programming capability based on the concept of "objects", which may contain data, in the form of
fields
, often known asattributes
; and code, in the form ofprocedures
, often known asmethods
orfunctions
.
Object Oriented Programming has a capability of programming/coding (more precisely, MODELLING) any(most of) real world scenarios.
- Data Encapsulation
- Data Abstraction
- Polymorphism
- Inheritence
- Modularity
Data Encapsulation or data hiding
is an Object Oriented Programming concept that binds together the data and functions that manipulate the data, and that keeps both safe from outside interference and misuse.
Data abstraction refers to providing only essential information to the outside world and hiding their background details
, i.e., to represent only the needed information in program without presenting the details.
The word “poly” means many and “morphs” means forms, So Polymorphism means many forms
(Looking alike but exhibit different characteristics).
Polymorphism allows us to perform a single action in different ways. In other words, polymorphism allows you to define one interface and have multiple implementations.
-
When there are multiple functions with
same name but different parameters
then these functions are said to be overloaded. Functions can be overloaded or differentiated by change in number of arguments or/and change in type of arguments.
The capability of a class to derive properties and characteristics from another class is called Inheritance. Inheritance is one of the most important feature of Object Oriented Programming.
- Sub Class: The class that inherits properties from another class is called Sub class or Derived Class.
- Super Class: The class whose properties are inherited by sub class is called Base Class or Super class.