QtDesignPatterns/builderpattern/meakbuilder.h

21 lines
436 B
C++

#include "meal.h"
class MealBuilder
{
public:
Meal *prepareVegMeal ()
{
Meal * meal = new Meal();
meal->addFoodToVector(new VegBurger());
meal->addFoodToVector(new Coke());
return meal;
}
Meal *prepareNonVegMeal ()
{
Meal * meal = new Meal();
meal->addFoodToVector(new ChickenBurger());
meal->addFoodToVector(static_cast<ColdDrink *>(new Pepsi()));
return meal;
}
};