This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BlogObserver; | |
| class BlogSubject | |
| { | |
| public: | |
| virtual ~BlogSubject() {} | |
| virtual void Subscribe(BlogObserver * observer) = 0; | |
| virtual void Unsubscribe(BlogObserver * observer) = 0; | |
| virtual void Notify() = 0; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BlogObserver | |
| { | |
| public: | |
| virtual ~BlogObserver() {} | |
| virtual void BlogUpdate() = 0; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "BlogObserver.h" | |
| class MyBlog; | |
| class Boss : public BlogObserver { | |
| public: | |
| Boss(MyBlog * blog); | |
| virtual ~Boss(); | |
| virtual void BlogUpdate(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "Boss.h" | |
| #include "MyBlog.h" | |
| #include "StringData.h" | |
| #include <iostream> | |
| #include <string> | |
| Boss::Boss(MyBlog * blog) | |
| : m_pBlog(blog) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "BlogObserver.h" | |
| class MyBlog; | |
| class CoWorker : public BlogObserver { | |
| public: | |
| CoWorker(MyBlog * blog); | |
| virtual ~CoWorker(); | |
| virtual void BlogUpdate(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "CoWorker.h" | |
| #include "MyBlog.h" | |
| #include "StringData.h" | |
| #include <iostream> | |
| #include <string> | |
| CoWorker::CoWorker(MyBlog * blog) | |
| : m_pBlog(blog) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "BlogObserver.h" | |
| class MyBlog; | |
| class Friend : public BlogObserver { | |
| public: | |
| Friend(MyBlog * blog); | |
| virtual ~Friend(); | |
| virtual void BlogUpdate(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "Friend.h" | |
| #include "MyBlog.h" | |
| #include "StringData.h" | |
| #include <iostream> | |
| #include <string> | |
| Friend::Friend(MyBlog * blog) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "BlogSubject.h" | |
| #include "StringData.h" | |
| #include <pthread.h> | |
| #include <string> | |
| #include <vector> | |
| class MyBlog : public BlogSubject { | |
| public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "MyBlog.h" | |
| #include "BlogObserver.h" | |
| MyBlog::MyBlog() | |
| : m_pBlogData(new BlogData()) | |
| { | |
| pthread_mutex_init(&m_mutex, NULL); | |
| } |
OlderNewer