0
我用C++进行编程已经有一段时间了,我正在尝试做一些练习题来再次熟悉语法。我正在编写一个基类为RetailEmployee
的程序,其中包含3个派生类:SalesEmployee
,WarehouseEmployee
和ManagerEmployee
。我有我的头顶部下面的代码派生类中的一种:C++派生类继承方法错误
// Sales Employee Class Header
#indef SalesEmployee
#define SalesEmployee
#include <stdio.h>
#include "RetailEmployee.h"
using namespace std;
class SalesEmployee
{
public:
SalesEmployee(string department, float pay, int ID, string name)
.
.
.
但是,任何时候我尝试使用的方法从基类上SalesEmployee比如我得到一个错误说的方法是未找到。而且,所有文件都在同一个目录中。
有没有人有任何建议?
class SalesEmployee:public RetailEmployee {...} - 您需要从基类继承。事实上,它只是它自己的班级。 – Chris 2014-11-21 19:03:59
你的ifdef后卫不应该是'#define SalesEmployee',它应该是'#define SALES_EMPLOYEE_H'。否则,这只是要求预处理器出现问题。 – Barry 2014-11-21 19:25:49