Updated output comment location for improved readability.

Reading the output before reading the line that would result in such output seemed to interrupt the flow of reading.
This commit is contained in:
Ian Dinwoodie
2019-05-19 17:54:39 -04:00
parent d82d783495
commit 040aedb6ce
7 changed files with 46 additions and 36 deletions

View File

@@ -92,28 +92,28 @@ class VanillaCoffee : public Coffee
int main()
{
std::shared_ptr<Coffee> simple = std::make_shared<SimpleCoffee>();
// Output: 3
std::cout << simple->getPrice() << std::endl;
// Output: Simple coffee
// Output: 3
std::cout << simple->getDescription() << std::endl;
// Output: Simple coffee
std::shared_ptr<Coffee> milk = std::make_shared<MilkCoffee>(simple);
// Output: 3.5
std::cout << milk->getPrice() << std::endl;
// Output: Simple coffee, milk
// Output: 3.5
std::cout << milk->getDescription() << std::endl;
// Output: Simple coffee, milk
std::shared_ptr<Coffee> whip = std::make_shared<WhipCoffee>(milk);
// Output: 5.5
std::cout << whip->getPrice() << std::endl;
// Output: Simple coffee, milk, whip
// Output: 5.5
std::cout << whip->getDescription() << std::endl;
// Output: Simple coffee, milk, whip
std::shared_ptr<Coffee> vanilla = std::make_shared<VanillaCoffee>(whip);
// Output: 6.5
std::cout << vanilla->getPrice() << std::endl;
// Output: Simple coffee, milk, whip, vanilla
// Output: 6.5
std::cout << vanilla->getDescription() << std::endl;
// Output: Simple coffee, milk, whip, vanilla
return 0;
}