adspace
When to use public class and when to use global class?
Answer Posted / Mukul Chaudhary
Public classes in Salesforce are accessible from any context (Apex code, Visualforce pages, etc.), but they must be used inside a namespace. Global classes, on the other hand, can be accessed without a namespace qualification, making them more flexible for reuse across different orgs and packages. However, global classes should only be used when necessary, as they may introduce potential naming conflicts and make your code less portable.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers