1. Field of the Invention
The present invention relates to the JAVA® programming language and particularly, a system and method of implementing a friendly class structure that enables a programmer to grant specific packages and classes access to a class that he or she creates without granting unnecessary access to other classes.
2. Description of the Prior Art
In the C++ language, there exists three levels of internal protection for the different members of a class: public, protected and private. For the case of members protected and private, these could not be accessed from outside the same class at which they are declared. Nevertheless, this rule is transgressed by making use of the C++ “friend” keyword in a class which permits an external function to gain access to the protected and private members of a class. Thus, in C++ language, in order to allow an external function to have access to the protected and private members of a class, there must be declared the prototye of the external function that will gain access preceded by the keyword “friend” within the class declaration that shares its members.
The JAVA® programming language (JAVA is a registered trademark of Sun Microsystems, Inc., located in Mountain View, Calif.) does not utilize a friend-type construct that would allow the programmer to grant specific classes nor packages access to a given class. In JAVA®, the programmer can make classes and methods private, protected, or public. Private access grants access to other methods within the same class and any subclasses. Protected access grants the same access as private but also grants access to any classes within the same package. Public access grants access to all classes.
With these levels of access in JAVA®, in order to allow another class to have access to a specific method, the programmer is forced to either grant access to every class within the package (using protected access), if that class is in the same package as the class that is being created by the programmer, or grant access to every Java class that is built with his or her class (using public access). Therefore, there may be classes that have access to the class created by the programmer to which he or she does not want to grant access.
It would be highly desirable to provide capability in the Java programming language to enable a programmer to grant specific packages and classes access to a class that he or she creates and particularly to allow specific classes to access his or her class without granting unnecessary access to other classes.
USPTO Backgrounds
USPTO Backgrounds