File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 5
5
#ifndef SOLID_PLANTCARETAKER_H
6
6
#define SOLID_PLANTCARETAKER_H
7
7
8
+ namespace caretaker
9
+ {
10
+ class PlantCareTaker
11
+ {
12
+ bool windowBlindsOpen = true ;
13
+
14
+ public:
15
+ void pourWater ();
16
+ void sprinkleWater ();
17
+
18
+ void openWindowBlinds ();
19
+ void closeWindowBlinds ();
20
+ };
21
+ } // namespce caretaker
22
+
8
23
#endif // SOLID_PLANTCARETAKER_H
Original file line number Diff line number Diff line change 1
1
//
2
2
// Created by sajith on 3/25/21.
3
3
//
4
+ #include < iostream>
5
+ #include " caretaker/PlantCaretaker.h"
6
+
7
+
8
+ namespace caretaker
9
+ {
10
+ void PlantCareTaker::pourWater ()
11
+ {
12
+ std::cout << " Pouring water on Aloe\n " ;
13
+ }
14
+
15
+ void PlantCareTaker::sprinkleWater ()
16
+ {
17
+ std::cout << " Sprinkling water on Aloe\n " ;
18
+ }
19
+
20
+ void PlantCareTaker::openWindowBlinds ()
21
+ {
22
+ if (not windowBlindsOpen)
23
+ {
24
+ windowBlindsOpen = true ;
25
+ std::cout << " Opened window blinds for Aloe\n " ;
26
+ }
27
+ }
28
+
29
+ void PlantCareTaker::closeWindowBlinds ()
30
+ {
31
+ if (not windowBlindsOpen)
32
+ {
33
+ windowBlindsOpen = false ;
34
+ std::cout << " Closed window blinds for Aloe\n " ;
35
+ }
36
+ }
37
+ }// namespace caretaker
4
38
You can’t perform that action at this time.
0 commit comments