/*************************************************/
// R. A. Hillyard
// stuRecord02.cpp
// November 2001
//
// class with constructors
/*************************************************/

#include<iostream>
#include<string>

using namespace std;

class StuRecord
  {
  public:
    StuRecord();                                    //default constructor
    StuRecord(int id, string fname, string lname);  //3 arg constructor

    void input();
    void output();
    int    getidNum();
    string getFirst();
    string getLast();
  private:
    int idNum;
    string first;
    string last;
  };

/*************************************************/
// default constructor - no arguments
/*************************************************/
StuRecord::StuRecord()
  {
  cout << "In default Constructor\n";
  idNum = -6666;
  first = "";
  last = "";
  }
/*************************************************/
// constructor with three arguments
/*************************************************/
StuRecord::StuRecord(int id, string fname, string lname)
  {
  cout << "In 3 arg Constructor\n";
  idNum = id;
  first = fname;
  last = lname;
  }
/*************************************************/
void StuRecord::input()
  {
  cout << "enter id number, first name and last name: ";
  cin >> idNum >> first >> last;
  }
/*************************************************/
void StuRecord::output()
  {  cout << idNum << " " + first + " " + last << endl;  }
/*************************************************/
int StuRecord::getidNum()
  {  return idNum;  }
/*************************************************/
string StuRecord::getFirst()
  {  return first;  }
/*************************************************/
string StuRecord::getLast()
  {  return last;  }
/*************************************************/

/*************************************************/
int main()
  {
  //Declare 4 objects - initialized by the constructors
  StuRecord name1;
  StuRecord name2(1234, "Roger", "craft");
  StuRecord name3(3456, "merry", "Christmas");
  StuRecord name4;

  //set values by getting input from the user
  name1.input();
  
  //call constructor like this after object has been declared
  name4 = StuRecord(9345, "Happy", "Birthday");

  //display state of objects
  name1.output();
  name2.output();
  name3.output();
  name4.output();
  return 0;
  }//end main
/***************Program Output*******************
In default Constructor
In 3 arg Constructor
In 3 arg Constructor
In default Constructor
enter id number, first name and last name: 6723 Program Language
In 3 arg Constructor
6723 Program Language
1234 Roger craft
3456 merry Christmas
9345 Happy Birthday
*/