Autor Beitrag
patmann2001
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 201

Windows 7 Prof.
Delphi XE2
BeitragVerfasst: Di 02.09.03 09:14 
Hallo

Wenn man sich die Deklaration von z.B. BlockWrite ansieht:
Zitat:
procedure BlockWrite(var f: File; var Buf; Count: Integer [; var AmtTransferred: Integer]);

stellt man fest, das die letzte Variable AmtTransferred in [] Klammern steht. Man kann sie also weglassen.
Wie erstelle ich eine Procedure oder Function in der ich ebenfalls bestimmte Übergabeparameter weglassen kann.

Ich hoffe Ihr versteht meine Frage. :?

cu Patmann


Zuletzt bearbeitet von patmann2001 am Di 02.09.03 15:22, insgesamt 1-mal bearbeitet
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Di 02.09.03 09:39 
ausblenden Delphi-Quelltext
1:
procedure xyz(NormalerParameter: String; OptionalerParameter: String = 'blabla');					

Das ganze geht mit jedem Variablentyp...
ausblenden Delphi-Quelltext
1:
procedure xyz(NormalerParameter: Integer; OptionalerParameter: Integer = 123);					

...

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
patmann2001 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 201

Windows 7 Prof.
Delphi XE2
BeitragVerfasst: Di 02.09.03 15:22 
Dank
Klappt
cu Patmann
Brueggendiek
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 304

Win 98, Win98SE, Win XP Home
D5 Std
BeitragVerfasst: Mi 03.09.03 21:38 
Hallo!

Ansonsten gibt es noch OVERLOAD - dann klappt es auch mit optionelen VAR-Parametern wie im Beispiel des Fragestellers.

Die überladene Prozedur ohne VAR-Parameter kann dann ja leicht eine lokale Variable deklarieren und dann die Prozedur mit dem VAR-Parameter aufrufen.

Gruß

Dietmar Brüggendiek