void StarbuzzCoffee() {
    Beverage * beverage = new Espresso();
    std::cout << beverage->getDescription() << " $" << beverage->cost() << std::endl;
    std::cout << "-------------------------" << std::endl;

    Beverage * beverage2 = new DarkRoast();
    std::cout << beverage2->getDescription() << " $" << beverage2->cost() << std::endl;
    beverage2 = new Mocha(beverage2);
    beverage2 = new Whip(beverage2);
    std::cout << beverage2->getDescription() << " $" << beverage2->cost() << std::endl;
    std::cout << "-------------------------" << std::endl;

    Beverage * beverage3 = new HouseBlend();
    std::cout << beverage3->getDescription() << " $" << beverage3->cost() << std::endl;
    beverage3 = new Soy(beverage3);
    beverage3 = new Mocha(beverage3);
    beverage3 = new Whip(beverage3);
    std::cout << beverage3->getDescription() << " $" << beverage3->cost() << std::endl;
    std::cout << "-------------------------" << std::endl;


    Beverage * beverage4 = new Decaf();
    std::cout << beverage4->getDescription() << " $" << beverage4->cost() << std::endl;
    beverage4 = new Milk(beverage4);
    std::cout << beverage4->getDescription() << " $" << beverage4->cost() << std::endl;
    std::cout << "-------------------------" << std::endl;

}
Esempio n. 2
0
int main() {
  Beverage* beverage = new Espresso();
  cout << beverage->getDescription() << "$ " << beverage->cost() << endl;
  delete beverage;

  Beverage* beverage2 = new DarkRoast();
  beverage2 = new Mocha(beverage2);
  beverage2 = new Mocha(beverage2);
  beverage2 = new Whip(beverage2);
  cout << beverage2->getDescription() << "$ " << beverage2->cost() << endl;
  delete beverage2;

  Beverage* beverage3 = new DarkRoast();
  beverage3 = new Soy(beverage3);
  beverage3 = new Mocha(beverage3);
  beverage3 = new Whip(beverage3);
  cout << beverage3->getDescription() << "$ " << beverage3->cost() << endl;
  delete beverage3;

  return 0;
}
	public: std::string getDescription() const {
		return _beverage->getDescription() + ", Whip";
	}
 string getDescription() {return beverage->getDescription() + ", Whip";}
 string getDescription() {return beverage->getDescription() + ", Mocha";}
	string getDescription() {
		return "From CondimentsDecorator: " + description + " {" + myBeverage->getDescription() + "} ";
	}
Esempio n. 7
0
 virtual string getDescription()
 {
     return beverage->getDescription() + ", " + description;
 }