-
Notifications
You must be signed in to change notification settings - Fork 0
/
34.cpp
48 lines (39 loc) · 853 Bytes
/
34.cpp
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
47
#include <iostream>
using namespace std;
class Microwave
{
int time, power_level;
public:
Microwave();
Microwave(int);
Microwave(int, int);
void showdata();
};
Microwave :: Microwave()
:time (60),power_level(10)
{
cout << "No argument Constructor executed" << endl;
}
Microwave :: Microwave(int time_var)
:time (time_var),power_level(10)
{
cout << "One argument Constructor executed" << endl;
}
Microwave :: Microwave(int time_var, int power_level_var)
:time (time_var),power_level(power_level_var)
{
cout << "Two argument Constructor executed" << endl;
}
void Microwave :: showdata()
{
cout << "Time = " << time << " Power Level = " << power_level << endl;
}
int main()
{
Microwave mw1, mw2(30), mw3(45,6),mw4 = mw3;
mw1.showdata();
mw2.showdata();
mw3.showdata();
mw4.showdata();
return 0;
}