The next technique for adjusting visibility is the simplest in concept, but often the most controversial in practice. The simplicity comes from simply changing a keyword in your method declarations. In Java or C++, you might change
public.1 Java also offers package default as an escalation from
private. In Perl’s Class::Std,2 you might change the
PRIVATE trait to
RESTRICTED or remove the
RESTRICTED trait. You get the idea.
1. A programmer—one of the most talented I have known at just getting things to work—put
#define private public in C++ before the headers of a third-party library to access members that were not otherwise exposed. Although I do not recommend using this technique, ...