Inheritance is a common way of extending and reusing the functionality of a class. Delegation is a more general way to extend a classes behavior. Delegation extends a class by using other classes functions, subroutines and properties rather than inheriting them. Inheritance is inappropriate for many situations in which delegation works well.
For example, inheritance is useful for capturing a “is-a-kind-of” relationships because of their very static nature. However, “is-a-role-played-by” relationships are akward to model with inheritance. With delegation you get instances of classes that can play multiple roles.
Category Archive: Code Techniques
May 29 2010
Class Delegation
Jan 11 2010
VBScript++
For the entire time I’ve been working with HP QuickTest Pro and VBScript, I have had a yearning for real object support. Specifically, inheritance and polymorphism. I am a big fan of reusing every piece of code I can, and these two attributes contribute more to my productivity than any other concept in software development.
In addition, at one point when we were performing a refactoring of our automation framework
May 11 2009
Implementing a GUI Layer with Classes (Russian Translation)
Sergey Talalaev has put his time and effort into translating Meir Bar-Tal’s article on Implementing a GUI layer with classes into Russian. We full-heartily thank Sergey on his continued help and support to the QTP community!
Apr 11 2009
Universal class for data manipulations
Sergey Talalaev (SQAdotBY) has contributed this wonderful article on using a generic class for all your Excel data-operations needs. Thanks SQAdotBY, for you hard work, and willingness to share it with the QTP community!
Dec 08 2008
Adding a Call-Chain Mechanism to QTP
Background and motivation A common frustrating experience is having your script pop-up an error dialog in some long-forgotten function, without one having the slightest clue in its regard. What usually follows is a series of trial-and-error breakpoint runs to determine which action the script was actually trying to perform when executing the function call that …
Oct 15 2008
Class Inheritance in VBScript – Now at your Doorstep!
ChangeLog: 5/10 : I’ve uploaded a new file with the fixed parser. Added support for code blocks with sensitive names (Function PrivateFunciton, Sub SpecialGet etc.) 10/10 : I’ve uploaded a new file with constructor arguments support, and a new regular expression engine (preserves comments and should make things go faster). Notice that the new file …
Jun 19 2008
An Improved Dictionary Object
The Scripting.Dictionary object can be an extremely useful tool for storing and retrieving information. We’ve had a whole series of QTips covering it’s basic uses, as well as some advanced articles of using it as a reserved global dictionary, a parameter storage for generic functions (here and here), and more. However, with all its power, …
Apr 01 2008
Factory Pattern
This article refers to design patterns, pointers and objects (discussed in the background section of this article), and classes. Make sure you’re familiar with these issues before reading on. It would also be prudent to brush up on the Singleton Pattern. We continue our tour of Design Patterns with another basic pattern – the Factory …
Apr 01 2008
Singleton Pattern
This article refers to design patterns, pointers and objects (discussed in the background section of this article), and classes. Make sure you’re familiar with these issues before reading on. We begin our exploration of the world of Design Patterns with one of the simplest patterns – the Singleton. The Gang of Four eloquently summarize the …
Mar 29 2008
Class Composition
This article deals with classes and their instances in VBScript. Make sure you’re familiar with the subject by reading the introduction article to classes. In this article we’ll cover the basics for composing classes (i.e. using one class from within another), and some common and less common uses for this technique. I’m sure that once …


Recent Comments