Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
Example from 'Head First Design Patterns' [1] is an example of a Strategy Design Pattern (converted from Java to C++).
Both the FlyBehavior and QuackBehavior are Strategies.
Operating system(s) or programming environment(s)
Libraries used:
TEMPLATE = app |
#ifndef DUCK_H |
#include "duck.h" |
#ifndef FLYBEHAVIOR_H |
#include "flybehavior.h" |
#include <iostream> |
#ifndef QUACKBEHAVIOR_H |
#include "quackbehavior.h" |
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.