Wednesday, April 11, 2012

100-cht-exam-computer , programing lanaguage and database (employee , manager)

// employee.h: interface for the employee class.

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

protected:
int base;
};

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

employee::employee()
{
employee(24000);
}

employee::employee(int inBase):base(inBase)
{
}

employee::~employee()
{
}

employee::setBase(int inBase)
{
base = inBase;
}

int
employee::calculateSalary() {
return base;
}

// employee.cpp: implementation of the employee class.
//
//////////////////////////////////////////////////////////////////////

#include "employee.h"


employee::employee()
{
employee(24000);
}

employee::employee(int inBase):base(inBase)
{
//base = inBase;
}

employee::~employee()
{
}

employee::setBase(int inBase)
{
base = inBase;
}

int
employee::calculateSalary() {
return base;
}

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

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

};

No comments:

熱門必看