By querying the
ApexClass object, one can list all the classes that exist within an organization. However, if the code which queries the classes is from a managed packaged, can it see all the records, or just the classes that are part of the package? Also, can it see another package class?
Considering the case where, in a subscriber org, you have the default namespace and two packages installed, can one of those packages read all the ApexClass records in the organization (and by reading I mean just acknowledging that the class/record exist, not reading its contents).
SELECT Id, Name, NamespacePrefix FROM ApexClass
would return a list like:
01p000000000000AAA | DefaultNSClass | 01p000000000001AAA | AnotherNSClass | anotherns 01p000000000002AAA | PackageNSClass | mypackagens