Method Overriding and Overloading Are Different Mechanisms

It is important to distinguish between method overloading presented in Chapter 12, “Class Anatomy Part I: static Class Members and Method Adventures,” and method overriding presented in this chapter. As noted in Syntax Box 16.2, an overriding method must have the same name and the same set of formal parameter types as the virtual base class method. In contrast, an overloading method has the same name but a different set of formal parameter types.

So if you included a method in your derived class that had the same name as a method in the base class but different formal parameter types, the method of the base class would not be overridden by the derived class method because of the differing ...

Get C# Primer Plus now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.