Chapter Summary

 < Free Open Study > 



Interface-based programming is a refinement of classical OOP, and the foundation for all things COM. Logically, an interface is a collection of semantically related functions describing a specific behavior. Physically, interfaces are a named set of pure virtual functions. This new programming discipline marks a clear distinction between interface and implementation.

You have learned that interfaces provide deeper encapsulation than traditional OOP, as a client holding an interface pointer is in reality holding a pointer to the class's vPtr. By building custom APIs that are capable of creating, destroying, and retrieving interface pointers for clients, we have further isolated the client from numerous implementation details. As well, the interface provides us with polymorphism, as any class supporting a given interface may define how the interface methods are implemented. To a client, however, if an object supports a named interface, it can be treated the same way.

Finally, you learned that interfaces specify a "contract" between the client and object. This contract also provides us with a roadmap as to how we can version interfaces safely and adapt a class with the latest and greatest interface updates, as well as build interface hierarchies.



 < Free Open Study > 



Developer's Workshop to COM and ATL 3.0
Developers Workshop to COM and ATL 3.0
ISBN: 1556227043
EAN: 2147483647
Year: 2000
Pages: 171

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net