Salesforce Platform Developer I (legacy) — Question 182

Cloud Kicks Fitness, an ISV Salesforce partner, is developing a managed package application. One of the application modules allows the user to calculate body fat using the Apex class, BodyFat, and its method, calculateBodyFat(). The product owner wants to ensure this method is accessible by the consumer of the application when developing customizations outside the ISV's package namespace.
Which approach should a developer take to ensure calculateBodyFat() is accessible outside the package namespace?

Answer options

Correct answer: D

Explanation

The correct answer is D, as using the global access modifier for both the class and the method allows them to be accessed outside the package namespace. Option A only makes the method accessible within the package, while option B restricts access to just the method and not the class itself. Option C incorrectly applies the access modifiers, which would not allow external access to the method.