Software Development Fundamentals — Question 18

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?

Answer options

Correct answer: C

Explanation

The correct way to call the base class method in derived classes is using MyBase. brake();, which allows access to the protected method from the Vehicle class. Options A and D are incorrect because they attempt to call the method directly from the Vehicle class or Truck class, respectively, which is not the correct syntax for accessing the inherited method. Option B is also wrong as 'This' is not a recognized keyword in many programming languages for this scenario.