diff --git a/Opdracht_2/AnalogeMeter.cpp b/Opdracht_2/AnalogeMeter.cpp index f865630..a38c3e8 100644 --- a/Opdracht_2/AnalogeMeter.cpp +++ b/Opdracht_2/AnalogeMeter.cpp @@ -10,5 +10,5 @@ AnalogeMeter::AnalogeMeter(Snelheid* s):Observer(s){ void AnalogeMeter::update() { - cout << "Analoog: " << dynamic_cast(getSubject())->geef(); + cout << "Analoog: " << dynamic_cast(getSubject())->geef() << endl; } \ No newline at end of file diff --git a/Opdracht_2/Observer.cpp b/Opdracht_2/Observer.cpp index eb440a8..6bf0f51 100644 --- a/Opdracht_2/Observer.cpp +++ b/Opdracht_2/Observer.cpp @@ -1,4 +1,4 @@ -#include "observer.h" +#include "Observer.h" void Subject::notify ( ){ for ( list::iterator i=L.begin( ); i!=L.end( ); ++i ) (*i)->update( ); diff --git a/Opdracht_3/Opdracht_3_Alt/main b/Opdracht_3/Opdracht_3_Alt/main new file mode 100755 index 0000000..9ef87b6 Binary files /dev/null and b/Opdracht_3/Opdracht_3_Alt/main differ diff --git a/Opdracht_3/Opdracht_3_Alt/main.cpp b/Opdracht_3/Opdracht_3_Alt/main.cpp index 3d724d0..54fb537 100644 --- a/Opdracht_3/Opdracht_3_Alt/main.cpp +++ b/Opdracht_3/Opdracht_3_Alt/main.cpp @@ -49,7 +49,6 @@ Observer::~Observer (){ class Element{ public: virtual ~Element () {} - virtual int draw () = 0; virtual string name () = 0; }; @@ -57,12 +56,12 @@ class Ninja : public Element, public Subject{ private: string Name; int AantalLevens; public: Ninja (string n) : Name(n), AantalLevens(1) { } - virtual int draw () { return AantalLevens; } virtual string name () { return Name; } virtual int aantalLevens () { return AantalLevens; } virtual void incLevens () { AantalLevens++; notify(); } virtual void decLevens () { AantalLevens--; notify(); } }; + // ================================================================ // Interfacelayer // ================================================================ @@ -70,8 +69,7 @@ class NinjaWindow : public Observer{ private: Ninja* N; public: NinjaWindow (Ninja* n) : Observer(n) {} virtual ~NinjaWindow () {} - //virtual void draw() { cout << N.name() << N.draw() << endl; } - virtual void update() {cout << dynamic_cast(getSubject())->name() << dynamic_cast(getSubject())->draw();} + virtual void update() {cout << dynamic_cast(getSubject())->name() << dynamic_cast(getSubject())->aantalLevens() << endl;} }; int main( ){ @@ -84,5 +82,4 @@ int main( ){ j.incLevens(); h.incLevens(); return 0; -} -// ================================================================ \ No newline at end of file +} \ No newline at end of file diff --git a/Opdracht_3/Opdracht_3_Alt/opdracht3.drawio b/Opdracht_3/Opdracht_3_Alt/opdracht3.drawio index c45161d..c1c42e9 100644 --- a/Opdracht_3/Opdracht_3_Alt/opdracht3.drawio +++ b/Opdracht_3/Opdracht_3_Alt/opdracht3.drawio @@ -1,6 +1,6 @@ - + @@ -11,10 +11,10 @@ - + - + @@ -27,58 +27,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -99,7 +47,7 @@ - + @@ -110,57 +58,13 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -174,7 +78,7 @@ - + @@ -229,31 +133,25 @@ - - + + - + - + - + - + - - - - - - @@ -278,45 +176,54 @@ - + - + - + - + - + - + - + - + - + + + + + + + + + +