Login   /   Register

Class inheritance in VBScript – Now at your doorstep!

October 4th, 2008 by Yaron Assa
     4 votes, average: 4 out of 54 votes, average: 4 out of 54 votes, average: 4 out of 54 votes, average: 4 out of 54 votes, average: 4 out of 5
Loading ... Loading ...

VBScript’s lack of class inheritance can be quite problematic for those of us who are using Classes regularly throughout our scripts. The attached file provides a parser which enables you to effectively use class inheritance in VBScript by placeing ‘ ParentClassName comments within your classes. The mechanism will:

1. Enable inheritance from multiple parents (just use multiple lines with Inherit comments)
2. Copies Properties, Variables, Functions and methods from the parent class to the derived class.
3. In case the derived class already has a code segment with the same name, the copied code-segment is changed to MyBase_. Inner segment placements are updated accordingly.
4. Enables inheritance through multiple hierarchies (e.g. GrandParent->Parent->Child inheritance). Circular inheritance protection. The order of appearance in the files is irrelevant, the parser will make sure the parent classes are parsed before their derived classes.
5. The parser has a major downside – as the technique uses ExecuteGlobal to load the processed classes into QTP, you cannot debug the code in mid-run.

An improved dictionary object

June 19th, 2008 by Yaron Assa
     3 votes, average: 4.67 out of 53 votes, average: 4.67 out of 53 votes, average: 4.67 out of 53 votes, average: 4.67 out of 53 votes, average: 4.67 out of 5
Loading ... Loading ...

This article will offer an improved version of the native Scripting.Dictionary object, and provide a step-by-step guid for building it.

Class Composition

March 29th, 2008 by Yaron Assa
     4 votes, average: 3.75 out of 54 votes, average: 3.75 out of 54 votes, average: 3.75 out of 54 votes, average: 3.75 out of 54 votes, average: 3.75 out of 5
Loading ... Loading ...

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 you’ll see the huge benefits we can gain by selectively using this technique, you’ll at least try it.

Introduction to classes

March 29th, 2008 by Yaron Assa
     1 votes, average: 4 out of 51 votes, average: 4 out of 51 votes, average: 4 out of 51 votes, average: 4 out of 51 votes, average: 4 out of 5
Loading ... Loading ...

This article will very briefly cover the subject of VBScript classes. My purpose is not to do a detailed sweep, but only a quick reminder in order to move forward to more advanced topics and techniques in articles to come. You can find detailed information and demos on this subject in the book Scripting Quicktest […]

Function Pointers in VBScript

October 22nd, 2007 by Meir Bar-Tal
     4 votes, average: 4.75 out of 54 votes, average: 4.75 out of 54 votes, average: 4.75 out of 54 votes, average: 4.75 out of 54 votes, average: 4.75 out of 5
Loading ... Loading ...

This 14-page article by Meir Bar-Tal explains in details the benefits and inherent possibilities in wrapping our functions with classes. It further explores the meaning and logical structure of classes, and shows how we can easily implement constructors, event handlers and callback by using class composition and function wrapping.
The different techniques are well illustrated […]