Home > Articles

  • Print
  • + Share This

One-To-Many Relationships

One-to-many references occur so often that we have developed a special class, known as a collection, to implement this type of relationship, as shown graphically in Figure 3.7. In this example, the CIBonds class indicates a collection of IBond interfaces, each of which can be subclassed as before. This CIBonds class has several methods associated with group management, such as Add, Remove, Item, and Count. If we defined a CPortfolio class, it might have a reference to a CIBonds class, as well as CIStocks and CIAssets classes, each of which are collections of IBond, IStock, and IAsset classes, respectively. Again, each of these final interface classes can be subclassed to provide specific implementations, yet the collection can manage them in their base interface class.

Figure 3.7 A one-to-many relationship and the collection class.

One-to-many relationships and the collection classes that implement them are synonymous with the master-detail relationships found across many applications. We will be using these collection classes frequently throughout our framework architecture. We will cover collections in detail in Chapter 7, "The ClassManager Library."

 

  • + Share This
  • 🔖 Save To Your Account

Related Resources

There are currently no related titles. Please check back later.