I just got the ver 9 and am playing with it. Using Bob Zales' stickies about objects I have a little class (primary school?) that works but only if I do not use "dim all". You can't "dim" the variable in the class code block so what gives? Note that Bob has not used "dim all" in his examples that I can see.
Another hiccup for me is not using the deprecated postfix like temp& for temp as long. Here is my code:
#COMPILE EXE
'#DIM ALL
FUNCTION PBMAIN () AS LONG
DIM stuff AS myInterface
DIM x&
'dim temp&
LET stuff = CLASS "myClass"
x& = stuff.bumpit(77)
MSGBOX STR$(x&)
x& = stuff.bumpit(x&)
MSGBOX STR$(x&)
END FUNCTION
'-----------------------------------------------------------------------------
'--------
'-----------------------------------------------------------------------------
CLASS myClass
'DIM temp AS LONG 'won't compile if decommented
'DIM temp& 'Requires Procedure
INSTANCE counter AS LONG
INTERFACE myInterface
INHERIT IDISPATCH
METHOD bumpit(inc AS LONG) AS LONG
INCR counter
temp& = counter + inc
METHOD = temp&
END METHOD
END INTERFACE
END CLASS
'-----------------------------------------------------------------------------
'--------
'-----------------------------------------------------------------------------
You can use both #DIM ALL and &. What you can't use is DIM to declare instance variables. You have to use INSTANCE.
#COMPILE EXE
#DIM ALL
FUNCTION PBMAIN () AS LONG
DIM stuff AS myInterface
DIM x&
LET stuff = CLASS "myClass"
x& = stuff.bumpit(77)
MSGBOX STR$(x&)
x& = stuff.bumpit(x&)
MSGBOX STR$(x&)
END FUNCTION
'-----------------------------------------------------------------------------
'--------
'-----------------------------------------------------------------------------
CLASS myClass
INSTANCE counter AS LONG
INSTANCE temp&
INTERFACE myInterface
INHERIT IDISPATCH
METHOD bumpit(inc AS LONG) AS LONG
INCR counter
temp& = counter + inc
METHOD = temp&
END METHOD
END INTERFACE
END CLASS
'-----------------------------------------------------------------------------
'--------
'-----------------------------------------------------------------------------