/* TitledName.h illustrates the use of inheritance.
 * ...
 */
 
#include "Name.h"

class TitledName : public Name
{
 public:
  TitledName();
  TitledName(const string& title, const string& firstName,
                const string& middleName, const string& lastName);
                
  string getTitle() const;
  void setTitle(const string& newName);
  
  void read(istream& in);
  void print(ostream& out) const;
  
 private:
  string myTitle;
};

inline TitledName::TitledName()
 : Name()   // , myTitle("")
{
   myTitle = "";
}

inline TitledName::TitledName(const string& title, const string& firstName,
                               const string& middleName, const string& lastName)
 : Name(firstName, middleName, lastName)
{
  myTitle = title;
}

inline string TitledName::getTitle() const
{
  return myTitle;
}

inline void TitledName::setTitle(const string& newTitle)
{
  myTitle = newTitle;
}

inline void TitledName::read(istream& in)
{
  in >> myTitle;
  Name::read(in);
}

inline void TitledName::print(ostream& out) const
{
  out << myTitle;
  Name::print(out);
}

  