Not exactly sure with your question, but if it is you don't want to expose the code to external user then you can put the global components in managed package.
1) Access modifiers 2) Access to apex class from profile level.
This may help you in understanding the security. If this question is not an interview question then you already understood the answer by above 2 points mentioned.
1) Access modifiers
2) Access to apex class from profile level.
This may help you in understanding the security. If this question is not an interview question then you already understood the answer by above 2 points mentioned.
Thanks,
_