Autor Beitrag
Jakob Schöttl
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: Fr 02.03.07 15:38 
Per Konvention schreibt man ja im private-Bereich einer Klasse vor Bezeichner, die im public-Bereich als Eigenschaften deklariert sind ein F für Field.

Meine Frage ist nun, ob man vor alle Variablen im private-Bereich ein F schreibt, oder eben nur vor die, die als Eigenschaften verwendet werden.

Danke schon mal für Antworten!
Coder
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1383
Erhaltene Danke: 1

WinXP
D2005 PE
BeitragVerfasst: Fr 02.03.07 15:49 
Das hängt von dem Styleguide ab nach dem du dich richtest.
Ich benutze den offiziellen: www.dsdt.info/grundlagen/styleguide/
Zitat:
Beginnen Sie jede Typdeklaration mit einem großen F.
www.dsdt.info/grundl...menskonventionen.php


MfG
Jakob Schöttl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: Fr 02.03.07 16:04 
ja, danke user profile iconCoder, sowas hab ich gesucht, und nach der Offiziellen Norm will ich mich natürlich auch richten.

Aber leider ist es auch hier nicht so genau beschrieben.

Mal ein Beispiel, vllt weiß es ja jemand aus dem Stegreif:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
class
  MyObject = class
  private
    FOptions: TOptions;  //gehört jetzt vor diese Variable auch ein F, oder nicht,
                         //weil sie ja nicht als Eigenschaft benutzt wird?
    FUserName: string;
  public
    property UserName: string read FUserName;
  end;
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: Fr 02.03.07 16:35 
Ich würde es vor jede private Variable machen, damit es keine Missverständnisse gibt. An dem F kannst du so leicht und ohne viel Nachdenken die Sichtbarkeit ableiten. ;)

_________________
Pascal keeps your hand tied. C gives you enough rope to hang yourself. C++ gives you enough rope to shoot yourself in the foot
Jakob Schöttl Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 929
Erhaltene Danke: 1


Delphi 7 Professional
BeitragVerfasst: Fr 02.03.07 16:48 
Ja ich glaub das mach ich auch. Danke