Exam4Training

What is the correct implementation of the ShippingCalculator class?

A developer must create a ShippingCalculator class that cannot be instantiated and must include a working default implementation of a calculate method, that sub-classes can override.

What is the correct implementation of the ShippingCalculator class?
A . Public abstract class ShippingCalculator {
public override calculate() { /*implementation*/ } }
B . Public abstract class ShippingCalculator {
public virtual void calculate() { /*implementation*/ } }

C . Public abstract class ShippingCalculator {
public abstract calculate() { /*implementation*/ } }
D . Public abstract class ShippingCalculator {
public void calculate() { /*implementation*/ } }

Answer: B

Explanation:

the extending class can override the existing virtual methods by using the override keyword in the method definition. Overriding a virtual method allows you to provide a different implementation for an existing method

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_extending.htm

Latest PDI Dumps Valid Version with 191 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Exit mobile version