Your full service technology partner! 
-Collapse +Expand
Search Delphi Group:

-Collapse +Expand Delphi To/From
-Collapse +Expand Delphi Store

Prestwood eMagazine

October Edition
Subscribe now! It's Free!
Enter your email:

   ► KBProgrammingDelphi for W...OOP   Print This     
  From the February 2010 Issue of Prestwood eMag
Delphi OOP:
Delphi Member Property (
Posted 14 years ago on 12/20/2008 and updated 2/12/2010
Delphi Code Snippet:
 A flashcard from our Delphi Flashcards Library
 A code snippet from our Delphi Code Snippets Page


Delphi Member Property

Delphi uses a special property keyword to both get and set the values of properties. The read and write keywords are used to get and set the value of the property directly or through an accessor method. For a read-only property, leave out the write portion of the declaration.

You can give properties any visibility you wish (private, protected, etc). It is common in Delphi to start member fields with "F" ("FName" in our example) and drop the "F" with properties that manage member fields ("Name" in our example).

Syntax Example:
TCyborg = class(TObject)
  FCName: String;
  property CyborgName: String read FCName write FCName;


Share a thought or comment...
Comment 1 of 2

I would recommend FCyborgName rather than FCName.  Why introduce a new suffix.  If CyborgName was a good enough name for the property, why would it not also be a good enough name for the backing field?

I think using another name just introduces a possibility for confusion.  Particularly as the list of property names gets longer and longer.

Just my 2 cents worth.

Posted 12 years ago

Comment 2 of 2

Good point Mark. Real and fully descriptive names are always better.

Posted 12 years ago
Write a Comment...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.

Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P117A1
Enter key:
Code Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

 KB Article #101739 Counter
Since 12/20/2008
Go ahead!   Use Us! Call: 916-726-5675  Or visit our new sales site:

©1995-2022 Prestwood IT Solutions.   [Security & Privacy]