MCC - Marquez - CIS162AB - C++ Level I
P13 Summary of Separate Files Lecture
   cpp.gif

Description:
This is a simple summary of the lecture on how P11 SalesPerson class would be separated into different files. The lines in bold are the portions of P11 that already exist and that would be copied and pasted to a new file, or left in the current file. The lines in regular print are the items that would be created or added in the separate files.

Class Definition: 

create interface file : sales_person.h 

#ifndef SALES_PERSON_H    //last item to discuss
#define SALES_PERSON_H


class SalesPerson{
   list variables and prototypes under appropriate sections.

private:
protected:
public:

};





Stays in P11.cpp:

application file : P11.cpp

#include "sales_person.h"


prototypes, main, and definitions for the application go in this file.


void outputSalesInfo(ostream& target, ...);

main()
{
   open output file
   create salesPersonObj's
   outputSalesInfo()
   close file
}

void outputSalesInfo(ostream& target, ...)
{
   target << salespersonId, ...;
}




Function Defintions for class:

create implementation file: sales_person.cpp

#include "sales_person.h"


SalesPerson::SalesPerson()
{
   inputSalesPersonId();
   inputFirstName();
   inputLastName();
}

all functions with the class name as the prefix: SalesPerson::

Revised: 08/15/2003 - www.mc.maricopa.edu/~marquez/cis162ab/p13_summary.html