C++의 수퍼 클래스 내부에서 하위 클래스를 참조 할 때 약간 혼란 스럽습니다. 자바 주어진 예를 들어 : ComplexEntity가 entity.It works.In에게 내가 getCentity() 오류를 호출하지 하위 클래스를 확장슈퍼 클래스의 C++ 참조 하위 클래스
public class Entity {
protected ComplexEntity _ce;
public Entity() {
}
public ComplexEntity getCentity() {
return _ce;
}
}
.
이제, C에서 + +를 내가 그런 걸 쓸 때 :
#pragma once
#include "maininclude.h"
#include "ExtendedEntity.h"
using namespace std;
class EntityBase
{
public:
EntityBase(void);
EntityBase(const string &name);
~EntityBase(void);
protected:
ExtendedEntity* _extc;
string _name;
};
내가 무엇입니까 컴파일러 오류 : 그런 일이 않습니다이 Entity.Why에서 상속 된 클래스에서
error C2504: 'Entity' : base class undefined
를?
C++에서는 완전히 받아 들일 수 있습니까?
5 월 엔티티는 추상적이어야합니다. 가능한 해결 방법에 대한 제안을 받고 싶습니다.
당신이 보여줄 수있는 C++ 코드가 있습니까? – jrok
1 분주세요 –