nerdexam
Microsoft

98-361 · Question #356

You need to provide printing functionality to several of your classes. Each class's algorithm for printing will likely be different. Also, not all the classes have an "is-a" relationship with each…

The correct answer is D. Create a common interface that all classes implement. See the full explanation below for the reasoning.

Question

You need to provide printing functionality to several of your classes. Each class's algorithm for printing will likely be different. Also, not all the classes have an "is-a" relationship with each other. How should you support this functionality?

Options

  • AAdd the print functionality to a base class with the public access modifier.
  • BHave all classes inherit from an abstract base class and override the base-class method
  • CHave all the classes inherit from a base class that provides the print functionality.
  • DCreate a common interface that all classes implement.

How the community answered

(43 responses)
  • A
    7% (3)
  • B
    5% (2)
  • C
    14% (6)
  • D
    74% (32)

Community Discussion

No community discussion yet for this question.

Full 98-361 Practice