MB-500 · Question #228
Drag and Drop Question You are working on a project in Dynamics 365 Finance. You use abstract and interface classes to implement the following requirements for the project: - Child classes must have…
The correct answer is Abstract; Interface; Abstract. X++ Class Types in Dynamics 365 Finance - Explained The Three Requirements and Their Answers --- Requirement 1 → Abstract "Child classes must have common private and public methods." An abstract class can contain both private and public methods with full implementations that…
Question
Exhibit
Answer Area
Drag items
Correct arrangement
- Abstract
- Interface
- Abstract
Explanation
X++ Class Types in Dynamics 365 Finance - Explained
The Three Requirements and Their Answers
Requirement 1 → Abstract
"Child classes must have common private and public methods."
An abstract class can contain both private and public methods with full implementations that child classes inherit as shared, common behavior.
- Interfaces cannot have private methods - all interface members are implicitly public
- Final class is disqualified entirely - it cannot be extended, so "child classes" cannot exist
- Abstract class is the only option that supports both access modifiers in an inheritable parent
Requirement 2 → Interface
"All methods must be implemented in the child classes."
An interface is a pure contract - every method declared in it has no body, so any class implementing it must provide a concrete implementation for every method. There are no exceptions.
- An abstract class can have already-implemented (non-abstract) methods that child classes don't need to override - so it doesn't guarantee all methods are implemented by the child
- An interface guarantees 100% implementation obligation on the implementing class
Requirement 3 → Abstract
"You must be able to implement the methods of the parent class."
An abstract class can contain methods with actual code bodies - the parent class itself implements those methods. Child classes can call them via super().
- An interface has no method bodies - it cannot implement anything itself
- Abstract class is unique in being able to mix abstract (unimplemented) and concrete (implemented) methods in the same parent
Common Mistakes
| Mistake | Reality |
|---|---|
| Using Interface for shared private methods | Interfaces have no private members in X++ |
| Using Abstract for "all methods must be implemented by child" | Abstract classes can have pre-implemented methods children don't have to override |
| Confusing "abstract method" with "abstract class" | An abstract class can hold both abstract and fully implemented methods |
| Considering Final class for any requirement involving child classes | final explicitly prevents inheritance - no children possible |
Quick Rule of Thumb
- Abstract = shared behavior + optional enforcement + private members allowed
- Interface = total enforcement, no implementations, public only
- Final = no inheritance ever
- Public class = standard class, no special constraints
Topics
Community Discussion
No community discussion yet for this question.
