Source File: ex55a.cpp

#include <fmt/core.h>
#include <chrono>
#include <thread>
#include <string>
#include <functional>
#include <memory>

using std::shared_ptr, std::make_shared, std::string;

struct Person {
  std::string name;
  int age;
};

shared_ptr<Person> Person_new(const string& name, int age) {
  auto self = make_shared<Person>(name, age);
  return self;
}

void Person_talk(shared_ptr<Person> self) {
  fmt::println("I am {} and I am {} years old.",
      self->name, self->age);
}

int main(int argc, char* argv[]) {
  auto zed = Person_new("Zed", 51);
  auto mary = Person_new("Mary", 28);

  Person_talk(zed);
  Person_talk(mary);

  return 0;
}