-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtut21.cpp
More file actions
31 lines (29 loc) · 697 Bytes
/
Copy pathtut21.cpp
File metadata and controls
31 lines (29 loc) · 697 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
#include<iostream>
using namespace std;
class Employee
{
private:
int a, b;
public:
int c, d;
void setdata(int a1, int b1); //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;
}
};
void Employee :: setdata(int a1, int b1){
a = a1;
b = b1;
}
int main(){
Employee vighnesh;
//vighnesh.a = 56; // a is private---can't be accessed directly
vighnesh.setdata(1,2);
vighnesh.d = 5;
vighnesh.c = 8;
vighnesh.getdata();
return 0;
}