Wednesday, April 11, 2012

100-cht-exam-computer , programing lanaguage and database (staff , main)

// staff.h: interface for the staff class.
#include "employee.h"

class staff : public employee
{
public:
int calculateSalary();
staff();
staff(int);
virtual ~staff();

};

// staff.cpp: implementation of the staff class.
#include "staff.h"

staff::staff()
{
employee();
}

staff::staff(int inBase)
{
setBase(inBase);
}

staff::~staff()
{

}

int staff::calculateSalary()
{
return base+10000;
}

// company.cpp : Defines the entry point for the console application.

#include "employee.h"
#include "manager.h"
#include "staff.h"
#include <iostream.h>

int main(int argc, char* argv[])
{
employee *e[2];
e[0] = new manager(24000);
e[1] = new staff(24000);

for(int i=0; i<2; i++) {
cout << e[i]->calculateSalary() <<endl;;
}

return 0;
}

No comments:

熱門必看