70 lines
1.7 KiB
C++
70 lines
1.7 KiB
C++
// Implementation file for the Park class
|
|
// Written By: Iurii Tatishchev
|
|
// Reviewed By: Iurii Tatishchev
|
|
// IDE: CLion
|
|
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
#include "Park.h"
|
|
|
|
using namespace std;
|
|
|
|
// **************************************************
|
|
// Constructor
|
|
// **************************************************
|
|
Park::Park() {
|
|
code = "";
|
|
state = "";
|
|
name = "";
|
|
description = "";
|
|
year = -1;
|
|
}
|
|
|
|
// **************************************************
|
|
// Overloaded Constructor
|
|
// **************************************************
|
|
Park::Park(string cd, string st, string nm, string dsc, int yr) {
|
|
code = cd;
|
|
state = st;
|
|
name = nm;
|
|
description = dsc;
|
|
year = yr;
|
|
}
|
|
|
|
// ***********************************************************
|
|
// Displays the values of a Park object member variables
|
|
// on one line (horizontal display)
|
|
// ***********************************************************
|
|
void Park::hDdisplay() const {
|
|
cout << code << " ";
|
|
cout << state << " ";
|
|
cout << year << " ";
|
|
cout << name << " ";
|
|
//cout << "(" << description << ")";
|
|
cout << endl;
|
|
}
|
|
|
|
// ***********************************************************
|
|
// Displays the values of a Park object member variables
|
|
// one per line (vertical display)
|
|
// ***********************************************************
|
|
void Park::vDisplay() const {
|
|
cout << name << endl;
|
|
cout << description << endl;
|
|
cout << state << endl;
|
|
cout << year << endl;
|
|
|
|
}
|
|
|
|
/* overloaded operators
|
|
* - the stream insertion operator ( << ) based on hDisplay
|
|
*/
|
|
ostream &operator<<(ostream &out, const Park &park) {
|
|
out << park.code << " ";
|
|
out << park.state << " ";
|
|
out << park.year << " ";
|
|
out << park.name << " \n";
|
|
return out;
|
|
}
|