DelphiFAQ Home Search:

When is 'protected' useful for a method or member?

 

comments1 comments. Current rating: 1 stars (1 votes). Leave comments and/ or rate it.

Question:

When should a method be declared protected?

Answer:

It tells the users of your class that you do not want them to access those properties or methods and that they need to be careful when doing it.


Comments:

2006-08-21, 08:05:44
anonymous from Belgium  
rating
outside of the unit where it is declared, a protected method is only accessible by derived classes.

you generally have to be careful about using such a method but that's not the main point of declaring it 'protected'.

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: