Re: Private variables question



yannis <none@xxxxxxxxxx> wrote in news:mn.f3f17d848d8a3df8.0@xxxxxxxxxx:

Phill Harvey-Smith laid this down on his screen :
Hi,

This is more from a mater of interest than any technical reason, but
there seems to be a lot of code around where the private variables are
called FSomething e.g.

TYPE TSomeType=class(object)
PRIVATE
FLocalVar : INTEGER;
PUBLIC
PROPERTY LocalVar : INTEGER READ FLocalVar;
END;

What I guess i'm asking is why prefix it with 'F' ? I have been
tending to use 'Pr' in my own code for Private, I guess the compiler
does not care, just wondered why it seemed to be a convention ?

As every body said it is F from Field.

Indeed, that makes much more sense now :)

Me on the other hand I couldn't care less what the prefix is (finally)
I just use the auto complete feature of the IDE which auto prefix the
private members with F and it doesn't give me an option which I can
change it. So it is easier to type
property Count : integer; CTRL+SHIFT+C
and let the IDE create the private variable for me along with the
setter method and let it at that.

Well I never so you can, I must try and remember that, it always amazes me
that I have been using Delphi 7 since it was released and there is still
stuff I don't know about it...neat trick indeed.

Cheers.

Phill.
.



Relevant Pages

  • Re: by default, public or private?
    ... "If the Dim statement is used or no access modifier ... private in Visual C# structures. ... the most you can limit the access level, and even all Private variables ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Class private to a namespace
    ... default - only access from same package. ... Private and protected are available for nested types (and private is ... Private -- private variables can be used by any member or procedure w/i the ... ProtectedFriend -- Can only be used in classes. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Class private to a namespace
    ... default - only access from same package. ... Private and protected are available for nested types (and private is ... Private -- private variables can be used by any member or procedure w/i ... ProtectedFriend -- Can only be used in classes. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Will python never intend to support private, protected and public?
    ... > language ... ... Well I have the following reasons not to like the current python way: ... Beginning all your private variables with an underscore is like ...
    (comp.lang.python)
  • Re: Need help with calling one class from another
    ... isn't accessing the private field, ... value to the nested class anyway. ... the nested class can see "private" members of the containing class, ... private variables. ...
    (microsoft.public.dotnet.languages.csharp)