mirror of
https://github.com/iandinwoodie/cpp-design-patterns-for-humans.git
synced 2025-12-17 04:24:40 +03:00
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:
@@ -95,8 +95,8 @@ int main()
|
||||
addLettuce().
|
||||
addTomato().
|
||||
build();
|
||||
// Output: 2 patties, pepperoni, lettuce, tomato
|
||||
burger->getDescription();
|
||||
// Output: 2 patties, pepperoni, lettuce, tomato
|
||||
|
||||
// One triple patty buger with everything.
|
||||
std::shared_ptr<Burger> burger2 = BurgerBuilder(3).
|
||||
@@ -105,8 +105,8 @@ int main()
|
||||
addLettuce().
|
||||
addTomato().
|
||||
build();
|
||||
// Output: 3 patties, cheese, pepperoni, lettuce, tomato
|
||||
burger2->getDescription();
|
||||
// Output: 3 patties, cheese, pepperoni, lettuce, tomato
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -46,18 +46,18 @@ int main()
|
||||
// Make a door with dimensions 100x200.
|
||||
std::shared_ptr<Door> door = DoorFactory::makeDoor(100, 200);
|
||||
|
||||
// Output: width = 100
|
||||
std::cout << "width = " << door->getWidth() << std::endl;
|
||||
// Output: height = 200
|
||||
// Output: width = 100
|
||||
std::cout << "height = " << door->getHeight() << std::endl;
|
||||
// Output: height = 200
|
||||
|
||||
// We can use the factory again to make a door with dimensions 50x100.
|
||||
std::shared_ptr<Door> door2 = DoorFactory::makeDoor(50, 100);
|
||||
|
||||
// Output: width = 50
|
||||
std::cout << "width = " << door2->getWidth() << std::endl;
|
||||
// Output: height = 100
|
||||
// Output: width = 50
|
||||
std::cout << "height = " << door2->getHeight() << std::endl;
|
||||
// Output: height = 100
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user