Visibility
in Detailed Design |
Prof. David Bernstein
|
Computer Science Department |
bernstdh@jmu.edu |
Block | Entity is (created and) accessible within a block of code |
Subprogram | Entity is accessible within a subprogram (e.g., local variables; parameters passed by value |
Referential | Visibility is temporarily provided to another entity (e.g., parameters passed by reference) |
Class/File | Entity is visible to all entities within a
class/file (e.g., private variables in Java;
static variables in C) |
Generalized | Entity is accessible to its class and all
extensions (e.g., protected variables in Java) |
Group | Entity is accessible to all members of a
pre-defined group (e.g., package visibility in
Java, COMMON blocks in FORTRAN) |
Complete | Entity is visible everywhere (e.g.,
public variables in Java; global variables) |
+
-
#
public int length;
public void paint(Graphics g){ }
public class String{ }
private int size;
private void recalculate(){ }
protected String title;
protected void layout(){ }
class Converters { }
An Example
javaexamples/datahiding/WillNotCompile.java