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 인스턴스의 기본 클래스에서 메소드를 사용하려고 찾을 수 없습니다. 또한 모든 파일은 동일한 디렉토리에 있습니다.
누구에게 의견이 있습니까?
클래스 SalesEmployee : public RetailEmployee {...} - 기본 클래스에서 상속해야합니다. 그것이 그대로, 그 자체의 수업. – Chris
ifdef 가드는'#define SalesEmployee'가 아니어야합니다. #define SALES_EMPLOYEE_H와 같아야합니다. 그렇지 않으면 전처리기에 문제가 있는지 묻는 것입니다. – Barry