-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut21.cpp
More file actions
33 lines (31 loc) · 705 Bytes
/
tut21.cpp
File metadata and controls
33 lines (31 loc) · 705 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include<bits/stdc++.h>
using namespace std;
class employee
{
private:
int a,b,c;
public:
int d,e;
void setData(int a ,int b, int c);//declaration
void getData(){
cout<<"the value of a is "<<a<<endl;
cout<<"the value of b is "<<b<<endl;
cout<<"the value of c is "<<c<<endl;
cout<<"the value of d is "<<d<<endl;
cout<<"the value of e is "<<e<<endl;
}
};
void employee :: setData(int a1,int b1,int c1){
a=a1;
b=b1;
c=c1;
}
int main(){
employee harry;
// harry.a=134 //this will generate error as a is private and cant be accessed.
harry.d=34;
harry.e=89;
harry.setData(1,2,4);
harry.getData();
return 0;
}