QtDesignPatterns/builderpattern/meakbuilder.h

21 lines
436 B
C
Raw Permalink Normal View History

2024-02-06 17:21:37 +08:00
#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;
}
};