죄송한 말씀이지만, 질문하신 분은 지금 개발하실 게 아니라 C 기초문법책에서 포인터 기초를 먼저 공부하셔야 할것 같습니다.
포인터와 클래스 기초가 안되면 C++은 아무것도 안됩니다.
아무튼, 다음과 같이 하시면 됩니다.
class TestClass {
public:
String time;
};
//---------------------------------------------------------------------------
int __fastcall CompareProc(void *Item1, void *Item2)
{
return CompareText(((TestClass*)Item1)->time, ((TestClass*)Item2)->time);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TList* list = new TList;
TestClass* test = new TestClass();
test->time = L"00:00:34";
list->Add(test);
TestClass* test2 = new TestClass();
test2->time = L"00:00:01";
list->Add(test2);
list->Sort(CompareProc);
for (int i = 0; i < list->Count; i++) {
Memo1->Lines->Add(((TestClass*)list->Items[i])->time);
}
}
|