好了,這裏是我的代碼:從「無效*」無效的轉換類(C++)
StatusType System::AddJobSearcher(void *DS, int engineerID, int reqSalary) {
if(DS == NULL || engineerID < 0 || reqSalary < 0) return INVALID_INPUT;
System* system = DS;
Engineer* engineer = new Engineer(engineerID, reqSalary);
if(!engineer) return ALLOCATION_ERROR;
if(system->All.isIn(*engineer->generateIdKey())) {
delete(engineer);
return FAILURE;
}
system->All.insert(*engineer->generateIdKey(), *engineer);
return SUCCESS;
}
現在,系統是一類和DS應該是指針之一。 當我嘗試新創建的系統指向DS(系統*系統= DS)獲得:
從 '無效*' 到 '系統*' 無效的轉換[-fpermissive]
我該如何解決這個問題
可怕的代碼。你確定你知道C++嗎? – Puppy
不是......但是,謝謝:) –