forked from gayashanbc/observer-pattern-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSubject.hpp
More file actions
38 lines (27 loc) · 696 Bytes
/
Subject.hpp
File metadata and controls
38 lines (27 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// Created by shan on 4/7/17.
//
#ifndef OBSERVER_PATTERN_SUBJECT_HPP
#define OBSERVER_PATTERN_SUBJECT_HPP
#include "Observer.hpp"
/**
* Interface for the Subject
*/
class Subject {
public:
/**
* Register an observer
* @param observer the observer object to be registered
*/
virtual void registerObserver(Observer *observer) = 0;
/**
* Unregister an observer
* @param observer the observer object to be unregistered
*/
virtual void removeObserver(Observer *observer) = 0;
/**
* Notify all the registered observers when a change happens
*/
virtual void notifyObservers() = 0;
};
#endif //OBSERVER_PATTERN_SUBJECT_HPP