Created
January 30, 2014 15:53
-
-
Save trikitrok/74cd4f76941dffa6700d to your computer and use it in GitHub Desktop.
Duck class implementation
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 "Duck.h" | |
#include "QuackBehavior.h" | |
Duck::Duck(QuackBehavior * quackBehavior) { | |
howToQuack = quackBehavior; | |
} | |
Duck::~Duck() { | |
delete howToQuack; | |
} | |
void Duck::quack() { | |
howToQuack->quack(); | |
} | |
void Duck::changeHowToQuack(QuackBehavior * quackBehavior) { | |
delete howToQuack; | |
howToQuack = quackBehavior; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment