Previous section
To contents
Next section
6.8 Modifiers
Sometimes, you may wish to hide things from inheriting programs, or
prevent functions from being called from other objects. To do so you use
modifiers. A modifier is simply a word written before a variable
definition, function definition, class definition or an inherit that
specifies how this identifier should interact with other objects and programs.
These modifiers are available:
- static
- Static hides this identifier from the index and arrow operators, which
makes it impossible for other objects to call this function unless a
function pointer to it is returned from inside this program.
- final
- This prevents other objects from re-defining this identifier in
programs that inherit this program.
- local
- This makes the identifier 'local' meaning that even if
it is overloaded in an inheriting program, this program will still
use this identifer.
- private
- This prevents inheriting programs from accessing this identifier.
Note that inheriting program can still re-define the identifier.
Also note that private does not imply static.
- public
- This is the opposite of private. This is the default for
all identifiers. public can be used to override the effects
of a private inherit.
- protected
- Reserved for future use.
When modifiers are used in conjunction with inherit, all the variables,
functions and classes copied from the inherited class will be modified
with the keywords used. For instance, private inherit means that
the identifiers from this inherit will not be available to program inheriting
this program. static private inherit will also hide those identifiers
from the index and arrow operators, making the inherit available only to the
code in this program.
Previous section
To contents
Next section