O'Reilly logo

Start Here!™ Fundamentals of Microsoft® .NET Programming by Rod Stephens

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Overriding Members

When a child class overrides a member, it defines a new version for a member that is already defined in the parent class.

For example, suppose that you have defined the Person and Employee classes described in the previous section, and that the Person class defines the AddressEnvelope method. Now, suppose that you add a new MailStop property to the Employee class. In that case, you can override the AddressEnvelope method in the Employee class so that it prints the address with the MailStop added.

Now, if the code calls AddressEnvelope for a Person object, the original version of the method executes. If the code calls AddressEnvelope for an Employee object, the new version of the method executes.

The really amazing thing about overridden ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required