該代碼可以正常運行,但在一個非特定時刻IM在行C++異常訪問衝突
return lhs.getGeneralType()->getID() != rhs.getGeneralType()->getID();
和錯誤打破我的申請得到一個異常訪問衝突 ...香港專業教育學院已經嘗試過用編譯/ EHA但錯誤
重複......這行代碼正確運行多次,一段時間後,會出現此錯誤..
if (lhs.getType() == rhs.getType()) {
try {
if (lhs.getGeneralType() != NULL && lhs.getGeneralType() != NULL)
return lhs.getGeneralType()->getID() != rhs.getGeneralType()->getID();
else if (lhs.getGeneralType() == NULL && lhs.getGeneralType() == NULL)
return false;
else if (lhs.getGeneralType() != NULL && lhs.getGeneralType() == NULL)
return false;
else if (lhs.getGeneralType() == NULL && lhs.getGeneralType() != NULL)
return true;
else
return true;
} catch(char * e) { // tried also exception & , char* e
return true;
}
} else
return true;
,其類型getGeneralType()返回的定義是低於
class Type
{
private:
int _id;
public:
Type(int id);
operator int() const;
int getID() const;
};