Hi ppl!
I need to write an observer, and this is what I've got so far:
The problem: void update() won't take a subject! Why is that? It works with add_observer so it should work with update, right?Code:#ifndef OB #define OB #include <iostream> using namespace std; class observer { public: observer(); virtual void update(subject s); }; class subject { vector<observer> observers; public: void add_observer(observer& ob); subject(); void notify(); }; inline subject::subject() { } #endif
Does it show that i'm new to c++?
/Henrik