Rolling back use of typedef with smart pointers.

This is to reduce the obfuscation of the code.
This commit is contained in:
Ian Dinwoodie
2019-05-14 19:19:26 -04:00
parent e262981359
commit 092d1a21f9
4 changed files with 21 additions and 27 deletions

View File

@@ -35,7 +35,7 @@ class WoodenDoor : public Door
class DoorFactory
{
public:
static Door::ptr_t makeDoor(float width, float height)
static std::shared_ptr<Door> makeDoor(float width, float height)
{
return std::make_shared<WoodenDoor>(width, height);
}
@@ -44,7 +44,7 @@ class DoorFactory
int main()
{
// Make a door with dimensions 100x200.
Door::ptr_t door = DoorFactory::makeDoor(100, 200);
std::shared_ptr<Door> door = DoorFactory::makeDoor(100, 200);
// Output: width = 100
std::cout << "width = " << door->getWidth() << std::endl;
@@ -52,7 +52,7 @@ int main()
std::cout << "height = " << door->getHeight() << std::endl;
// We can use the factory again to make a door with dimensions 50x100.
Door::ptr_t door2 = DoorFactory::makeDoor(50, 100);
std::shared_ptr<Door> door2 = DoorFactory::makeDoor(50, 100);
// Output: width = 50
std::cout << "width = " << door2->getWidth() << std::endl;