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

Polymorphism

Polymorphism is the ability for an object to act as if it were a parent class. For example, suppose that you have an Employee class derived from a Person. In that case, the program should be able to treat an Employee object as if it were a Person. That makes intuitive sense because an employee is a kind of person.

If a program has a routine that takes a Person as a parameter, the code should be able to pass that routine an Employee object. An Employee object has all the properties, methods, and events that a Person object does (plus possibly more), so the routine should be able to use the Employee object in the same way that it would use a Person object.

As a specific example, suppose that the Person class defines the FirstName, LastName, ...

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