operator override question 
Author Message
 operator override question


I am using VBScript to define a class and objects.
Is it possible to override the + operator as well as = operator?
That is, to achieve the following:

Class A
statement.....
End Class

set obj1 = new A
set obj2 = new A
set obj3 = obj1 + obj2

Another question:
Do I need constructor for defining the new object?
If not, how can I initialize the new instance object?

Thanx a lot



Sat, 09 Nov 2002 03:00:00 GMT  
 operator override question
You can't do operator overloading in VBScript.

For initialization, include

Sub Class_Initialize()
    ...
End Sub

in the definition of the class...

--
Michael Harris
MVP Scripting


I am using vbscript to define a class and objects.
Is it possible to override the + operator as well as = operator?
That is, to achieve the following:

Class A
statement.....
End Class

set obj1 = new A
set obj2 = new A
set obj3 = obj1 + obj2

Another question:
Do I need constructor for defining the new object?
If not, how can I initialize the new instance object?

Thanx a lot



Sat, 09 Nov 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. operator override question

2. Operator Overrides

3. Overriding Arithmetic Operators (help!)

4. TabControl Oncontroladded override question

5. Basic Operators Question

6. Question : how to operator the Tape in VB

7. OR operator question...

8. newbie question: pointers and bitwise operators and OCX file

9. question on VB New operator

10. Question on settransfer operator

11. Restore operator question

12. 'toArray operator esoteric question

 

 
Powered by phpBB® Forum Software