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 PausedState : public MusicPlayerState { | |
| public: | |
| PausedState(); | |
| virtual ~PausedState(); | |
| virtual void Play(MusicPlayer * player); | |
| virtual void Stop(MusicPlayer * player); | |
| }; |
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
| PlayingState::PlayingState() | |
| : MusicPlayerState(std::string("Playing")) { | |
| } | |
| PlayingState::~PlayingState() { | |
| } | |
| void PlayingState::Pause(MusicPlayer * player) | |
| { |
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 PlayingState : public MusicPlayerState { | |
| public: | |
| PlayingState(); | |
| virtual ~PlayingState(); | |
| virtual void Pause(MusicPlayer * player); | |
| virtual void Stop(MusicPlayer * player); | |
| }; |
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
| MusicPlayerState::MusicPlayerState(std::string name) | |
| : m_name(name) { | |
| } | |
| MusicPlayerState::~MusicPlayerState() { | |
| } | |
| void MusicPlayerState::Play(MusicPlayer *) |
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 MusicPlayerState { | |
| public: | |
| MusicPlayerState(std::string name); | |
| virtual ~MusicPlayerState(); | |
| virtual void Play(MusicPlayer * player); | |
| virtual void Pause(MusicPlayer * player); | |
| virtual void Stop(MusicPlayer * player); |
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
| MusicPlayer::MusicPlayer() | |
| : m_pState(new StoppedState()){ | |
| } | |
| MusicPlayer::~MusicPlayer() { | |
| delete m_pState; | |
| } |
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 MusicPlayer { | |
| public: | |
| enum State | |
| { | |
| ST_STOPPED, | |
| ST_PLAYING, | |
| ST_PAUSED | |
| }; | |
| MusicPlayer(); |
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
| int main() | |
| { | |
| Librarian librarian; | |
| librarian.DisplayBookCollection(); | |
| } |
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
| Librarian::Librarian() | |
| : m_pBookCollection(new BookGroup(std::string("Book Collection"))) | |
| { | |
| BuildBookCollection(); | |
| } | |
| Librarian::~Librarian() { | |
| delete m_pBookCollection; | |
| } |
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 Librarian { | |
| public: | |
| Librarian(); | |
| virtual ~Librarian(); | |
| void DisplayBookCollection(); | |
| private: | |
| void BuildBookCollection(); | |
| BookComponent * BuildFictionGroup(); |