How to make a java class only available to one other class in a package -
How to make a java class only available to one other class in a package -
i have 3 classes, bst, term, , webpages.
bst binary search tree terms in each node.
webpages instantiates bst.
how can ensure bst class only available webpages class? (that requirement of project)
they should in same package, thing makes sense me nested class within webpages. there other way restrict access entire class 1 other class in same bundle can "see" it?
looks inner class best alternative you
here quote javaworld descirbes same situation!
for example, tree class may have method , many helper methods perform search or walk of tree. object-oriented point of view, tree tree, not search algorithm. however, need intimate knowledge of tree's info structures accomplish search. inner class allows remove logic , place own class.
java
Comments
Post a Comment