IT SOLUTIONS
Your TECHNOLOGY partner! 
-Collapse +Expand
Prism
Search Prism Group:

Advanced
-Collapse +Expand Prism Group Home
-Collapse +Expand Message Board
-Collapse +Expand Prism KB
-Collapse +Expand Prism To/From
To/FromCODEGuides
-Collapse +Expand Prism Study Test
PRESTWOODCERTIFIED
-Collapse +Expand Prism Store
PRESTWOODSTORE
-Collapse +Expand Members Only

Prestwood eMagazine

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

   ► KBProgrammingDelphi PrismOOP    
Go To Random Article
  From the February 2013 Issue of Prestwood eMag
 
Prism OOP:
Delphi Prism Class Member Visibility Levels
 
Posted 53 months ago on 12/19/2008 and updated 5/6/2009
Prism Code Snippet:
 A flashcard from our Prism Flashcards Library
 A code snippet from our Prism Code Snippets Page


General Info: Class Visibility Specifiers

In OOP languages, members of a class have a specific scope that indicates visibility. Standard visibility includes private, protected, and public. Private members are usable by the defining class only (fully encapsulated). They are invisible outside of the class except by friendly classes. Protected members are usable by the defining class and descendant classes only (plus friendly classes). Public members are usable wherever its class can be referenced.

Languages Focus: Member Visibility

Traditional member visibility specifiers for fully OOP languages are private, protected, and public. Many modern OOP languages implement additional member visibilities.

Additional member modifiers are documented under the Member Modifiers topic.

Delphi Prism Class Member Visibility Levels

In Prism, you specify each class and each class member's visibility with a Class Member Visibility Level preceding the return type. Like Delphi, you group member declarations as part of defining the interface for a class in the Interface section of a unit.

Unlike Delphi, Prism supports a traditional OO approach to member visibility with additional .Net type assembly visibility. For example, private members are truly private to the class they are declared in. In Delphi for Win32, you use strict private for true traditional private visibility.

Prism also supports assembly and protected and assembly or protected which modify the visibility of protected members to include only descendants in the same assembly (and) or publicly accessible from assembly and descendant only outside (or). OO purist might object to assembly and protected and assembly or protected and I suggest you choose the traditional private, protected, and public as your first chose at least until you both fully understand them and have a specific need for them.

Syntax Example:
Cyborg = public class(System.Object)
private
  //private properties, methods, etc. here.
  FName: String;
protected 
  //protected properties, methods, etc. here.
assembly and protected
  //properties, methods, etc. here.
assembly or protected
  //properties, methods, etc. here.
public
  //properties, methods, etc. here.
end;

More Info

Definition:  Class Visibility Specifiers

Comments

1 Comments.
Share a thought or comment...
First Comment

mtiede
Comment 1 of 4

FWIW, several paragraphs are repeated in the post.

Posted 48 months ago


Mike Prestwood
Comment 2 of 4

Thanks for the heads up Mark. I also cleaned up  a grammar error too.

Posted 48 months ago


mtiede
Comment 3 of 4

No problem.

I should have been a proofreader.

The halls are kind of echoing around here.  I suspect there are even fewer .net Pascal programmers than there were win32 pascal programmers.

Posted 48 months ago

Latest Comment

Mike Prestwood
Comment 4 of 4

Hi Mark,

>>The halls are kind of echoing around here.

Yes, we get a lot of Delphi and Prism developers that "pass through" but don't stick around. Not sure why, but that's the reality. I was hoping over the years as the content got better and better that more developers would "stick" around. We do have quite a few that visit from time to time but only a few dozen that visit more than once a week.

Posted 48 months ago
 
Write a Comment...
Full Editor
Sign in...

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


Anonymous Post:

Enter your name and security key.

Your Name:
Today's security key = P257A
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 play-drums.com 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.



Linked Certification Question(s)

The following are practice certification questions with answers highlighted. These questions were prepared by Mike Prestwood and are intended to stress an important aspect of this KB post. All our practice questions are intended to prepare you generally for passing any certification test as well as prepare you for professional work.

Intermediate

1 Intermediate Level Question

Question #1: Multiple Choice

The class visibility specifiers are:

Answer:
1. 

private, strict private, protected, stict protected, public, and published.

2. 

private, protected, public, and published.

3. 

private, protected, internal, protected internal, and public.

4. 

private, protected, assembly and protected, assembly or protected, and public.

5. 

Private, Protected, Friend, Protected Friend, and Public.


 KB Article #101734 Counter
4368
Since 12/19/2008
-
  Load Time=less than 1 second.
 
Print This

KB Post Options:
-
 
Have a question? Need our services? Contact us now.
--Mike Prestwood

Call: 916-726-5675

email: info@prestwood.com


-
 
Connect With Us...
PrestwoodBoards
Join Us!
Facebook
Like our page!
Twitter
Follow us!
LinkedIn
Join Group
YouTube
View channel.
Go ahead!   Use Us! Call: 916-726-5675 


©1995-2013 Prestwood IT Solutions.   [Security & Privacy]   Made in the U.S.A..   No H1-B.   No offshoring.