Object Orientation
The object orientation topic hasn’t been touched yet because you must first know COM before we can really speak about COM object orientation. Thus far, you have gained all the basics of COM. You’ve learned how to wrap up a component from a number of classes, objects, and interfaces. You’ve also learned how to use the services exposed by these COM objects, and you’ve worked very hard to get to here. Everything you’ve learned so far involves classic notions of traditional systems programming: interfaces, objects, and classes. In this section, we will examine the object-oriented aspect of COM. Remember that COM is a model. The model supports the traditional object-oriented notions which include encapsulation, polymorphism, and reuse (or inheritance). In all these cases, COM surpasses the traditional notions, because it ratifies and strengthens them. We’ll first briefly examine these notions in the following sections, and then you’ll learn to write code that allows you to dynamically reuse binary components.
Encapsulation
COM not only supports the notion of encapsulation, but it strongly enforces it. The basis of COM is the distinct separation of interface from implementation. All COM objects are built from interfaces and all interfaces must be specified. Interfaces contain specification of methods, but don’t contain specification of states or implementations. In other words, an interface groups together a number of methods that a COM object supports, but it doesn’t ...