|
June 14, 2002 Using override Tips: June 2002
Yehuda Shiran, Ph.D.
|
|
Let's look at an example that demonstrates the override behavior. The class FirstBase has two methods: pitcher() and hitter(), each printing a unique message:
Let's define a derived class now. It redefines both the pitcher() and the hitter() methods. The pitcher() method will be marked as hide, and the hitter() function will be marked as override:
Let's create an instance of the derived class, SecondBase:
and call his pitcher() and hitter() methods:
The output should reflect the default of overriding the base methods:
To learn more about JScript .NET, go to Column 110, JScript .NET, Part IV: Inheritance.
People who read this tip also read these tips: Look for similar tips by subject: |