Encapsulation in c++
defination:- The wrapping up of data and functions into a single unit (called class) is known as encapsulation.
All C++ programs are composed of the following two fundamental elements:
1) Program statements (code): This is the part of a program that performs actions and
they are called functions.
2) Program data: The data is the information of the program, which is used by the
program functions.
OOP treats data, as an important element in program development, and does’ not allow
it to flow freely in the system. It ties data more closely to the functions that operate
on it in a data structure called class.
Encapsulation is an Object Oriented Programming concept that binds together the data
and functions, and that keeps both safe from outside misuse.
This feature is called “Data Encapsulation”, where data members and member
functions are packed in a class as small tablets are packed inside a capsule
(medicine).
Post a Comment
If you have any doubts, Please let me know
Thanks!