$CallingClass

$CallingClass
is an internal flag used to control the access to a class member.
This loads the package.
In[1]:=
Click for copyable input
We first define a small class hierarchy and a global function to test $CallingClass. Because the class generation checks for global references, we inform it about the reference to a global symbol by means of Import. The Override qualifier signals a change in the parent class functionality.
In[2]:=
Click for copyable input
The global function called has information which method called the method that called the global function, if it is called from a non-public method.