Skip to content

Commit 36dce47

Browse files
author
sajith
committed
Improved
1 parent 6a41478 commit 36dce47

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

plant-care/caretaker/include/caretaker/PlantCaretaker.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,19 @@
55
#ifndef SOLID_PLANTCARETAKER_H
66
#define SOLID_PLANTCARETAKER_H
77

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+
823
#endif //SOLID_PLANTCARETAKER_H
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,38 @@
11
//
22
// Created by sajith on 3/25/21.
33
//
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
438

0 commit comments

Comments
 (0)