Functions and properties can be declared as private
. These are only accessible
by other stuff inside of that class; they are inaccessible anything outside
of that class.
In this case, something()
is private
, so we cannot call it from main()
.
We can call something()
from somethingElse()
, as both of those are functions
on Foo
. And, since somethingElse()
is public (the default), we can call
somethingElse()
from main()
and therefore indirectly call something()
from
main()
.
You can learn more about this in:
Tags: