-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatic.cpp
More file actions
44 lines (38 loc) · 786 Bytes
/
static.cpp
File metadata and controls
44 lines (38 loc) · 786 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
#include <iostream>
using namespace std;
class employee
{
int id;
static int count;
public:
void setData(void)
{
cout << "Enter the ID: ";
cin >> id;
count++;
}
void getData(void)
{
cout << "The ID of the employee "<< count<< " is: " << id<<endl;
}
static void getcount(void)
{
cout<<"The value of the count is: "<<count<<endl;
}
} ;
int employee:: count;
int main()
{
static int count;
employee aniket,prince,akash;
aniket.setData();
aniket.getData();
employee::getcount();
prince.setData();
prince.getData();
employee::getcount();
akash.setData();
akash.getData();
employee::getcount();
return 0;
}