Autor Beitrag
new-bee
Hält's aus hier
Beiträge: 3



BeitragVerfasst: Do 04.05.06 11:53 
Hi

ich muss für meinen Info GK ein Referat über "records" halten.

Nur weiß ich noch gar nichts darüber, habe ja auch erst seit 2 Monaten mit Delphi zu tun!

Könnte mir jemand erklären was das is un wofür man das braucht?


Danke schonmal
New-Bee
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Do 04.05.06 12:02 
Man verwendet Records, wenn man verschiedene daten zusammenfassen will. Im Unterschied zu Arrays, können die einzelnen Werte verschiedene Typen haben.

z.B.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
type 
  TPerson = Record
    Name, Vorname: string;
    GebDat: TDateTime;
    ...
  end;

var
  Heinz: TPerson;
...
begin
  Heinz.Vorname := 'Heinz';

_________________
Markus Kinzler.
new-bee Threadstarter
Hält's aus hier
Beiträge: 3



BeitragVerfasst: Di 09.05.06 12:31 
ah ok das is ja schon mal ne nette Hilfe...

Aber so ganz verstanden habe ich das nicht!

Könnte das jemand nochmal näher erkären was zusammenfassen usw.?
mkinzler
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 4106
Erhaltene Danke: 13


Delphi 2010 Pro; Delphi.Prism 2011 pro
BeitragVerfasst: Di 09.05.06 12:37 

_________________
Markus Kinzler.
aim65
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 312

Win 9x, Win XP
Delphi 3pro, 7PE
BeitragVerfasst: Di 09.05.06 16:39 
Oder guckst Du hier: www.delphibasics.co....cle.asp?Name=Records
Ist allerdings in englisch.

Edit: oder das (deutsch):dsdt.info/grundlagen...he/komdatentypen.php


Zuletzt bearbeitet von aim65 am Di 09.05.06 16:50, insgesamt 1-mal bearbeitet
Marco D.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 2750

Windows Vista
Delphi 7, Delphi 2005 PE, PHP 4 + 5 (Notepad++), Java (Eclipse), XML, XML Schema, ABAP, ABAP OO
BeitragVerfasst: Di 09.05.06 16:43 
Für ein Quiz könntest du zur Verwaltung der Fragen ein Record verwenden:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
type
  TFrage=record
    frage:string;
    antwort1:string;
    antwort2:string;
    antwort3:string;
    antwort4:string;
    richtig:integer;
  end;

var Fragen : array[1..100of TFrage;

//So kannst du nun z.B. auf Frage1 zugreifen:
Frage[1].frage:='Blubb?';

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
delfiphan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2684
Erhaltene Danke: 32



BeitragVerfasst: Mi 10.05.06 23:11 
Eine etwas kompliziertere Record-Definition (ohne tieferen Sinn ;)). Für Delphi 2006.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
type
 MyRecord = packed record
 strict private
   FMode: Integer;
   function get(Index: Integer): Integer;
   procedure put(Index: Integer; const Value: Integer);
 public
   property Mode: Integer read FMode write FMode;
   property Arr[Index: Integer]: Integer read get write put; default;
   class function HiWorld: MyRecord; static;
   type MyType = (a,b);
   case MyType of
     a: (I: ^MyRecord);
     b: (FHello: set of MySet)
 end;


Zuletzt bearbeitet von delfiphan am Mi 07.06.06 19:10, insgesamt 1-mal bearbeitet
new-bee Threadstarter
Hält's aus hier
Beiträge: 3



BeitragVerfasst: Di 06.06.06 11:59 
Sorry aber ich nochma....Ihr habt mit das hier bestimmt ganz toll erklärt, nur habe ich noch net so richtig verstanden, wofür ich dasjetzt brauchen kann, oder was ich damit machen kann!



New-Bee
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6393
Erhaltene Danke: 147

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Di 06.06.06 12:04 
Auf meiner Website findest du unter Tutorials etwas über typisierte Dateien. Die arbeiten mit Records. Source gibt es auch dazu. Damit hättet du schonmal eine praktische Anwendung.

Stichwörter, die mir noch dazu einfallen:
- packed Record
- varianter Record