Video Coming Soon...

Created by Zed A. Shaw Updated 2026-06-19 17:00:40

54: Review Namespaces and Structs

This exercise is pending. Quick notes about this exercise:

Actually, I'm not sure why I'm reviewing this here but I'll solve that in the writing phase.

The Code

This code needs a bit more to it for the review:

View Source file ex54.cpp Only

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

using std::shared_ptr, std::make_shared;

namespace Person {
  // NOTE: not too sure about this, needs some thought
  struct Person {
    std::string name;
    int age{0};
  };

  shared_ptr<Person> create(const std::string& name, int age) {
    return make_shared<Person>(name, age);
  }
}

int main(int argc, char* argv[]) {
  auto zed = Person::create("Zed", 51);
}

The Breakdown

line of code
Description.

The Discussion

Blah blah.

Further Study

Previous Lesson Next Lesson

Register for Learn C++ the Hard Way

Register to gain access to additional videos which demonstrate each exercise. Videos are priced to cover the cost of hosting.