Ken Ismert
KIsmert at TexasSystems.com
Tue Mar 28 15:44:19 CST 2006
All objects have an implicit, or default interface. It is the set of property and method calling definitions (or signatures) for the object. Interfaces are nice because they allow the compiler check for calling compliance beforehand, and not wait until runtime to find out that a method was misspelled, or the wrong number of parameters given. Explicit interfaces are helpful with polymorphism -- when many objects need to assume one role, or one object needs to assume many roles. Many objects can implement a single interface, and thus provide services in a standard way to a consumer. Similarly, one object can implement many interfaces, and so fulfill many roles. Interfaces aren't as flexible as inheritance -- when an object implements an interface, it gets just the property and method signatures, but not any functionality. Each object must fill in the interface with its own functionality. Also, you get the whole interface -- you can't just implement the bits you like. While a minor part of the .NET object specification, interfaces are the cutting edge of object sophistication in VBA. And so it will remain -- VBA is a dead language, and will in not too many years be looked back on like Algol, or maybe Fortran. -Ken