-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (26 loc) · 744 Bytes
/
Copy pathmain.cpp
File metadata and controls
34 lines (26 loc) · 744 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
#include <QCoreApplication>
#include "subject.h"
#include "feedobserver.h"
#include "feedsubject.h"
#include "iobserver.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
FeedSubject *s1 = new FeedSubject;
FeedSubject *s2 = new FeedSubject;
IObserver *o1 = new FeedObserver;
IObserver *o2 = new FeedObserver;
IObserver *o3 = new FeedObserver;
IObserver *o4 = new FeedObserver;
s1->attach(o1, "esportes");
s1->attach(o2, "esportes");
s2->attach(o1, "esportes");
s2->attach(o2, "esportes");
s2->attach(o2, "musica");
s2->attach(o3);
s2->attach(o4);
s1->setState("2", "esportes");
s2->setState("3","musica");
s2->setState("99");
return a.exec();
}