O'Reilly logo

Access™ 2007 VBA Programmer's Reference by Armen Stein, Geoffrey Griffith, Rob Cooper, Teresa Hennig

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

13.11. The Three Pillars

So far, you've examined how to create class modules that are complete with their own properties and procedures. You've seen how to develop their implementation code, instantiate them as objects, link them to other objects singly and in collections, and finally, use them in the application. For most cases, this is all you need to know.

But if you want to create a lot of related classes, and do it in the most efficient way, then you need to understand a few principles of object-oriented programming.

The three pillars of object-oriented theory are:

  • Encapsulation

  • Inheritance

  • Polymorphism

These things have different meanings to different people, and the extent to which they apply to an object-oriented language differs according to which language you happen to prefer. There are other factors like operation overloading, parameterized constructors, and class-level attributes, but their discussion is largely irrelevant because they are not implemented in Access 2007.

13.11.1. Encapsulation

A major advantage of object-oriented programming is the capability to encapsulate, or contain data and functionality within simple programmatic entities. That is, every instance of a class object contains exactly the same properties and methods as the class module it was based on. You've seen this in the classes you've created in this chapter.

Another way to describe encapsulation is data hiding. When you create a set of properties and methods to form a class's interface, external ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required