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

“Is-A” Versus “Has-A”

Two common concepts in object-oriented design are “Is-A” and “Has-A.”

An Is-A relationship, more formally called a subclass or parent-child relationship, is when one kind of object is a type of some other kind of object. For example, a Customer is a Person.

You can model Is-A relationships by using subclassing. For example, you can derive the Customer class from the Person class. The Person class includes all the properties and methods that are generally applicable to persons, and the Customer class adds those that apply only to customers. (Note that using two classes would be overrefinement if Person has no other child classes, such as Employee.)

A Has-A relationship, more formally called composition, is when one kind of object ...

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