Modernes C++ programmieren

Okt 20, 2024

lst-0030-book.cpp

// https://godbolt.org/z/Wo8zaq9WW 
#include <string>
#include <string_view>
using std::string; using sview = std::string_view;
struct Person {
    string name_ = "no name";
    int age_ = -1;
    string city_ = "no city";
    Person() {}
    Person(sview n, int a, sview c)
      : name_{n}, age_{a}, city_{c} { }
    Person(sview n, int a)
      : name_{n}, age_{a} { }
    Person(sview n)
      : name_{n} { }
};