2. OBJECT –
Object is an identifiable entity with some characteristics and behavior. It represents an entity that can store data and its associative functions. Generally, we can say..
“An Object is a Self-contain entity that consists of both data and procedures to manipulate data. It is the basic unit of Object-oriented programming.”
Technically, in Object-oriented language.. We may combine the code and data in such a way leading to the formation of self-contained “black box“. When linking of code and data takes place together in this fashion, an object forms.
Furthermore, for all intents and purposes, an object is variable of a user-define type. However, in Object-oriented programming, each time you define a new type of object, you are creating a new data type. Each specific instance of this data type is a compound variable.
For example, in general layman’s Language.. “Orange” is an object. Its characteristics are :
- It is Spherical in shape.
- It is Orange in colour.
Its behaviour is :
- It is juicy.
- It tastes sweet-sour.
3. ABSTRACTION –
Abstraction refers to the act of representing essential features and information to the outside world.. Without the background details or explainations. Furthermore, we can say..
“Abstraction is.. providing only necessary information and hiding the background details. That means just representing the information in need without presenting the complete details.”
Following are the examples of Abstraction in a general layman’s Language..
- Generally, in a switch board, you only press the certain switches according to your requirement. What’s happening inside, how it’s happening, you needn’t know. This is Abstraction.
- Furthermore, while driving a car, you only know the essential features to drive a car. Such as gear handling, steering handling, use of clutch, accelerator, break, etc. But, while driving do you get into internal details of car like wiring, motor working!? The Answer is NO because you are unaware about what is happening inside. This is Abstraction, where you only know the essential things to drive a car without its background details or explainations.
4. ENCAPSULATION –
Encapsulation, as the name suggests.. Is the process of combining data and functions at the same place to create a new entity. Furthermore, we can also define the concept as following..
“Encapsulation is the wrapping up of data and functions or operations (that operate on the data) into a single unit. Furthermore, Encapsulation implements data abstraction.”
Especially relevant, encapsulation ensures that the user may access the data of a class.. But, only by authorised functions. These are the member functions and friend functions of a class. Generally with encapsulation, No one can access the data directly.. Thus, it is safe from accidental alteration.
Therefore, we can conclude that Encapsulation is the mechanism that binds together code and the data it manipulates. Also, it keeps both safe from outside interference and misuse.