[語法] 關於List的問題

看板C_and_CPP (C/C++)作者 (累人啊....)時間16年前 (2009/03/16 18:14), 編輯推噓1(102)
留言3則, 2人參與, 最新討論串1/1
如題,我將其類別撰寫如下 //Arc.h #ifndef ARC_H #define ARC_H #include <string> using namespace System::Drawing; using namespace System::Drawing::Drawing2D; using namespace std; class ArcLine{ public: ArcLine(); ~ArcLine(); }; #endif //Arc.cpp #include "stdafx.h" #include "Arc.h" using namespace System::Drawing; ArcLine::ArcLine(){} //A_List.h #ifndef A_LIST_H #define A_LIST_H #include "Arc.h" class Truckload_Arc{ public: Truckload_Arc(); void Add_Arc(ArcLine* pArc); private: class A_List{ public: A_List(ArcLine* pNew_Arc):pArc(pNew_Arc), pNext(0){} ArcLine* pArc; A_List* pNext; }; A_List* pHead; A_List* pTail; A_List* pCurrent; }; //A_List.cpp #include "stdafx.h" #include "Arc.h" #include "A_List.h" Truckload_Arc::Truckload_Arc(){pHead=pTail=pCurrent=0;} void Truckload_Arc::Add_Arc(ArcLine* pArc){ A_List* pA_List= new A_List(pArc); if (pHead) pTail->pNext=pA_List; else pHead=pA_List; pTail=pA_List; } 但是在主程式呼叫時如下 Truckload_Arc Arc_Truckload; Arc_Truckload.Add_Arc(new ArcLine(ID,Position,Position)); 上面這行則會出錯,錯誤訊息如下 error C2061: 語法錯誤 : 識別項 'ArcLine' error C2660: Truckload_Arc::Add_Arc' : 函式不使用 3 引數 error C2143: 語法錯誤 : 遺漏 ';' (在 ')' 之前) error C2143: 語法錯誤 : 遺漏 ';' (在 ')' 之前) 因為我有其它的類別,其型式皆與這個類似,所以都copy的 但奇怪的是其它的都可以,只有這個Arc會出錯,仔細對過後應該和其它格式相同 請問這該怎麼解決呢,謝謝,為了版面,簡化了很多東西,如須要再補的話 再請推文一下,謝謝 ※ 編輯: tyc5116 來自: 163.18.48.28 (03/16 18:15)

03/16 19:11, , 1F
ArcLine 沒有吃三個引數的 ctor
03/16 19:11, 1F

03/16 19:12, , 2F
而且 memory leak的情形好像很多喔 @@a
03/16 19:12, 2F

03/16 19:48, , 3F
不太懂....
03/16 19:48, 3F
文章代碼(AID): #19lYQLae (C_and_CPP)
文章代碼(AID): #19lYQLae (C_and_CPP)