-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArray_of_objects.cpp
More file actions
46 lines (40 loc) · 965 Bytes
/
Array_of_objects.cpp
File metadata and controls
46 lines (40 loc) · 965 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
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
using namespace std;
class Employee{
int id;
int salary;
public:
void setId(void){
cout<<"Enter the id of employee"<<endl;
cin>>id;
}
// void setsal(void){
// cout<<"Enter the salary of employee"<<endl;
// cin>>salary;
// }
void getId(void){
cout<<"The id of this employee is "<<id<<endl;
}
// void getsal(void){
// cout<<"The salary of the employee is "<<salary<<endl;
// }
};
int main(){
/* Employee Harry, Aditya, Gitanjali;
Harry.getId();
Harry.setId(); //This methode is useful for few employees but not for thousand's
*/
Employee fb[3];
for (int i = 0; i < 3 ; i++)
{
fb[i].setId();
fb[i].getId();
// if (i==1)
// {
// fb[i].setsal();
// }
}
// fb[1].getId();
// fb[1].getsal();
return 0;
}