exam questions

Exam CRT-450 All Questions

View all questions & answers for the CRT-450 exam

Exam CRT-450 topic 1 question 174 discussion

Actual exam question from Salesforce's CRT-450
Question #: 174
Topic #: 1
[All CRT-450 Questions]

A developer must create a CreditCardPayment class that provides an implementation of an existing Payment class.

Which is the correct implementation?
A.

B.

C.

D.

Show Suggested Answer Hide Answer
Suggested Answer: B

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
1vanTT
5 months ago
B. See response to sirerick and link from DonAldos for explanation
upvoted 2 times
...
DonAldos
2 years ago
Correct: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_extending.htm
upvoted 2 times
...
sirerick
2 years, 1 month ago
Why isn't A?
upvoted 1 times
1vanTT
5 months ago
If you were making the method in CreditCardPayment virtual you would also need to make the class virtual, otherwise any other class extending it would not be able to extend e.g. you still also need to use the override keyword in CreditCardPayment in order for it to work... public virtual class Payment { public virtual void makePayment(Decimal amount){ } } public virtual class CreditCardPayment extends Payment{ public virtual override void makePayment(Decimal amount){ } } public class RevolutPayment extends CreditCardPayment { public override void makePayment(Decimal amount){ } }
upvoted 3 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago