Modernes C++ programmieren

Okt 23, 2024

lst-0251-book.cpp

// https://godbolt.org/z/vzneMWW9r 
#include <string>
#include <string_view>
using std::string; using sview = std::string_view;
struct Person {
    string name_ = "kein Name";
    int alter_ = -1;
    string ort_ = "kein Ort";
    Person() {}
    Person(sview n, int a, sview o)
      : name_{n}, alter_{a}, ort_{o} { }
    Person(sview n, int a)
      : name_{n}, alter_{a} { }
    Person(sview n)
      : name_{n} { }
};