When a derived class contains a method or property that overrides a parent class method or property, how can you use the parent class version from within the subclass? Show an example of a derived class that overrides a parent class method, but then uses the parent class method.

What will be an ideal response?

When a derived class contains a method or property that overrides a parent class method or property, you might have occasion to use the parent class version within the subclass. If so, you can use the keyword base to access the parent class method or property. For example:
class CommissionEmployee : Employee
{
new public string GetGreeting()
{
string greeting = base.GetGreeting();
greeting += "\nI work on commission.";
return greeting;
}
}

Computer Science & Information Technology

You might also like to view...

Excel includes several tools to help you clean up data automatically

Indicate whether the statement is true or false

Computer Science & Information Technology

A defined name that is distinctive and easy to remember, typically describes the ________ of the selected cells

Fill in the blank(s) with correct word

Computer Science & Information Technology