#ifndef PERSON_H
#define PERSON_H

#include "String.h"

struct Date {
  int day;    // 1 .. 31
  int month;  // 1 .. 12
  int year;   // YYYY
};

class Person {

private:
  String name;
  String first;
  Date birth;

public:
  // constructor
  // Person(const String& n, const String& fn, const Date& d) {
  //   name  = n;  first = fn;  birth = d;
  // }

  Person(const String& n, const String& fn, const Date& d) :
    name(n), first(fn), birth(d)
  {}

  // copy constructor
  // Person(const Person& rhs) {
  //   name  = rhs.n;  first = rhs.fn;  birth = rhs.d;
  // }

  // copy constructor (better)
  // Person(const Person& rhs) : name(rhs.n), first(rhs.fn), birth(rhs.d) {}

  // destructor
  // ~Person(void) {}

  // access functions
  const String& lastName(void) const {return name;}
  const String& firstName(void) const {return first;}
  const Date& birthday(void) const {return birth;}

  // comparison operators
  bool operator<=(const Person& rhs) const {
    return ((lastName() < rhs.lastName()) ||
            ((lastName() == rhs.lastName()) &&
             (firstName() <= rhs.firstName())));
  }
};


#endif /* PERSON_H */