Delphi Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
델파이 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
FreePascal/Lazarus
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
델마당
볼랜드포럼 광고 모집

델파이 Q&A
Delphi Programming Q&A
[5415] >질문< TList의 사용법?
khsol7 [ ] 1101 읽음    1998-12-23 21:10
TList를 사용해 클래스의 정보를 목록으로 저장, 추룰하려고 합니다.
다음과 같이 코딩을 했는데 얻은 값이 모두 0으로만 나오네요.
어떤 작업이 더 필요한지 ...

type
Ttest = class
  a,
  b : Integer;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
tes : TTest;
begin
lstTest := TList.Create;

tes := TTest.Create;
tes.a := 1;
lstTest.Add(tes);
tes.Free;

tes := TTest.Create;
tes.a := 2;
lstTest.Add(tes);
tes.Free;

end;

procedure TForm1.Button2Click(Sender: TObject);
var
vte : TTest;
begin

  vte := TTest.Create;
  vte := lstTest.items[0];
  memo1.lines.add(IntToStr(vte.a));
  vte.Free;

  vte := TTest.Create;
  vte := lstTest.items[1];
  memo1.lines.add(IntToStr(vte.a));
  vte.Free;

  lstTest.Free;

end;

lstTest는 TList 형으로 전역 변수로 선언되어 있습니다.


+ -

관련 글 리스트
5415 >질문< TList의 사용법? khsol7 1101 1998/12/23
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.