VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

Systems Analysis - System analysis and Design tutorial for Software Engineering

You are here: Visual Basic > Advanced VB6 tutorial > Chapter 12

Methods for Using the Interface Class in a Client

When a client needs to refer to elements of a Class object that are implemented through an Interface class, the client must refer to the Interface by name to use the Interface elements.

There are two basic methods for referring to Interface elements within a class from client code. Both these methods assume that you have instantiated an object from a class that uses an Interface for all or part of its functionality:

  • Declare an object variable in the client whose type is the Interface class and set that object variable to point back to another object that you have already instantiated from the server's implementing class. You can then manipulate the Interface-type variable to manipulate the Interface-provided elements of the implementing client object.

  • Write wrapper routines in the client to manipulate various elements of the Interface. Each such routine will take as its parameter an object whose type is the Interface class. When you call the routines, however, you pass an instantiated object from the server's implementing class.

The following two sections discuss these methods.

  1. Method A: Using an Object Variable in the Client

  2. Method B: Using Wrapper Routines in the Client


<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © | All Rights Reserved