{
int rn;
char n[20];
//by default memebers of the class are private
public:
void getd()
{
}
void dispd()
{
}
};
//encapsulation wrapping or binding up of data and functions into a single unit called class so classes are used to encapsulate data and functions.
hide the information to outside world from direct use..
Abstraction is hiding internal implementation details ,just hilights the set of services to the outside world.for example..
University hides student information(like name,sex) to the examiner.but hiligthing the service as putMarks()..
class HallTicket
{
private:
char *name;
char *sex;
public:
void putMarks(){}
};
so examiner don't have any knowledge about name and sex etc..but he can put the marks by putMarks() service through the HallTicket object.
Encapsulation
holding the data behind the methods is called encapsulation..
hide the information to outside world from direct use..
Abstraction is hiding internal implementation details ,just hilights the set of services to the outside world.for example..
University hides student information(like name,sex) to the examiner.but hiligthing the service as putMarks()..
class HallTicket
{
private:
char *name;
char *sex;
public:
void putMarks(){}
};
so examiner don't have any knowledge about name and sex etc..but he can put the marks by putMarks() service through the HallTicket object.
Encapsulation
holding the data behind the methods is called encapsulation..
No comments:
Post a Comment