3.5. Advanced Class Programming

Part of the art of object-oriented programming is determining object relations. For example, you could create a Product object that contains a ProductFamily object or a Car object that contains four Wheel objects. To create this sort of object relationship, all you need to do is define the appropriate variable or properties in the class. This type of relationship is called containment (or aggregation).

For example, the following code shows a ProductCatalog class, which holds an array of Product objects:

public class ProductCatalog
    private Product[] products;

    // (Other class code goes here.)

In ASP.NET programming, you'll find special classes called collections that have no purpose other than to group various ...

Get Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional, Second Edition 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.