-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut21.cpp
More file actions
34 lines (30 loc) · 731 Bytes
/
tut21.cpp
File metadata and controls
34 lines (30 loc) · 731 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
34
#include<iostream>
using namespace std;
class Employ
{
private:
int a, b, c;
public:
int fo, e;
void setdata(int a1, int b1, int c1); //declaration
void getdata(){
cout<<"the value of a is "<<a<<endl;
cout<<"the value of c is "<<c<<endl;
cout<<"the value of b is "<<b<<endl;
cout<<"the value of e is "<<e<<endl;
}
};
void Employ :: setdata(int a1, int b1, int c1){
a = a1;
b = b1;
c = c1;
}
main(){
Employ saiman;
//saiman.a = 00 --> will throw error as defined private
saiman.e = 10;
saiman.fo = 80;
saiman.setdata(2, 3, 6);
saiman.getdata();
return 0;
}