//house.cpp #include //setw #include "house.h" using namespace std; house:: house() { //All windows and doors are built with their //default constructors. cout << "building a house." << endl; return; } house:: house(int rw, char fc[ ]): right(rw),front(fc) //initializers { //left is a default window, back is a default door //right and front are built using alternate constructors cout << "Building a custom house." << endl; return; } house::~house() { cout << "Destroying " << *this << endl; } ostream & operator<<(ostream & out, house & h) { out << "A house with: \n\t" << h.right << "\n\t" << h.left << "\n\t" << h.back << "\n\t" << h.front << endl; return out; } //test stub #define HOUSE_TEST #ifdef HOUSE_TEST int main() { cout << "THE PLAIN HOUSE." << endl; house plain; cout << '\n' << plain << endl; cout << "\n\nTHE POSH HOUSE." << endl; char doorColor[ ]="white"; house posh(10,doorColor); cout << '\n' << posh << endl; return 0; } #endif