错误 C2440:“=”:无法从“const BWAPI::UpgradeType”转换为“const BWAPI::Type *”
在这条线上
this->generalType = type;
问题是什么?因为 UnitType extends Type 不应该被允许?
class CombatEvent {
public:
CombatEvent& setUnitType(const UnitType& type);
const Type* getGeneralType() const;
private:
UnitType unitType;
const Type* generalType;
}
// implementation
CombatEvent& CombatEvent::setUnitType(const UnitType& type) {
this->generalType = type;
this->unitType = type;
return *this;
}