Visual Basic Concepts
Organizing Objects: The Object Model
An object model defines a hierarchy of objects that gives structure to an object-based program. By defining the relationships between objects that are part of the program, an object model organizes the objects in a way that makes programming easier.
The public object model of a component is especially important because it’s used by all the programmers who employ the component as part of their applications.
Note Users of C++ or other object-oriented programming languages are used to seeing class hierarchies. A class hierarchy describes inheritance. That is, it shows how objects are derived from simpler objects, inheriting their behavior. By contrast, object models are hierarchies that describe containment. That is, they show how complex objects like Worksheets contain collections of other objects, such as Button, Picture, and PivotTable® objects. Object models can be created with Visual Basic, Visual C++, and other tools that support COM and ActiveX.
"Programming with Objects," in the Visual Basic Programmer’s Guide, includes an introduction to object models and a discussion of design considerations for collection classes. The following topics on object models for components assume familiarity with that material.
Do I Need an Object Model? Many components provide one or more unrelated or loosely related objects that clients can create and use.
Externally Creatable Objects Discusses the objects you allow clients to create for themselves, using the New operator or the CreateObject function.
Dependent Objects Discusses objects clients cannot create, but can use once the component has created them.
Combining Externally Creatable and Dependent Objects How the relationship between the two kinds of objects shapes the object model.
Using Properties and Collections to Create Object Models Mechanics of fitting objects together into an object model, using properties and collections as glue.
Dealing with Circular References Linking objects together into an object model means that they keep references to each other. This has interesting consequences.
For More Information Further information on object models can be found in "ActiveX Component Standards and Guidelines."