feat(cmat): implement Ex41 observer pattern
Refactor the Pelican crossing exercise to use the Observer pattern: Pelican acts as Subject and each Pole observes it, replacing direct calls through the owned Pole pointer. Co-authored-by: Qwen 3.8 27B <qwen3.8_27b-q3_k_xl@lmstudio.local>
This commit is contained in:
+4
-1
@@ -1,13 +1,16 @@
|
||||
|
||||
#include "Keyboard.h"
|
||||
#include "Pelican.h"
|
||||
#include "Pole.h"
|
||||
#include "TimerSet.h"
|
||||
|
||||
#include <cctype> // provides toupper()
|
||||
|
||||
int main() {
|
||||
Keyboard kbd;
|
||||
Pelican thePelican(30, 0);
|
||||
Pelican thePelican;
|
||||
Pole pole1(20, 0, thePelican);
|
||||
Pole pole2(40, 0, thePelican);
|
||||
|
||||
char c = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user