observer_pattern::ConcreteSubject
-
class ConcreteSubject : public observer_pattern::Subject
Concrete implementation of a Subject.
Public Functions
Attach an observer to the subject.
- Parameters:
observer – The observer to attach.
Detach an observer from the subject.
- Parameters:
observer – The observer to detach.
-
inline virtual void notify() override
Notify all attached observers of a change.
-
inline virtual std::string getState() const override
Get the current state of the subject.
- Returns:
The current state as a string.
-
inline virtual void setState(const std::string &newState) override
Set the state of the subject and notify observers.
- Parameters:
newState – The new state of the subject.