nerdexam
Microsoft

98-361 · Question #52

You have a class named Truck that inherits from a base class named Vehicle. The Vehicle class includes a protected method named brake (). How should you call the Truck class implementation of the…

The correct answer is C. MyBase. brake(). The MyBase keyword behaves like an object variable referring to the base class of the current instance of a class. MyBase is commonly used to access base class members that are overridden or shadowed in a derived class.

Understanding Object-Oriented Programming

Question

You have a class named Truck that inherits from a base class named Vehicle. The Vehicle class includes a protected method named brake (). How should you call the Truck class implementation of the brake () method?

Options

  • AVehicle. brake ();
  • BThis. brake ();
  • CMyBase. brake();
  • DTruck. brake ();

How the community answered

(26 responses)
  • A
    4% (1)
  • B
    4% (1)
  • C
    81% (21)
  • D
    12% (3)

Explanation

The MyBase keyword behaves like an object variable referring to the base class of the current instance of a class. MyBase is commonly used to access base class members that are overridden or shadowed in a derived class.

Topics

#inheritance#base class method call#MyBase keyword#method invocation

Community Discussion

No community discussion yet for this question.

Full 98-361 Practice