Write a program to use data hiding method(encapsulation and abstraction)


 

/* Write a program to use data hiding method(encapsulation and abstraction)*/

 

#include<iostream.h>

#include<conio.h>

class abc

{

double a,b,c;

public:

void read();

void disp();

};

void abc::read()

{

cout<<“enter a and b,c=”;

cin>>a>>b>>c;

}

void abc::disp()

{

cout<<a<<endl<<b<<endl<<c;

}

void main()

{

clrscr();

abc a1;

a1.read();

a1.disp();

getch();

}

/*output:

enter a and b,c=10  20 30

10

20

30*/

Related Posts

Comments are closed.