This is directed at either Nan or Thomas (Object.inc creators), but anyone who knows can voice their two cents :)

What I want to do is this:


Box firstBox(80,20,10)
Box secondBox()


Inotherwords I want to be able to supply my own constructors and have a default constructor...

Basically I want to be able to do this:



mov hBox, $NEW( Box, 0, 0, 10 )
mov hBox2, $NEW( Box )


This is possible, I hope...
:) :) :)

Sliver


---EDIT---
Here is my default constructor right now:



; --=====================================================================================--
; #METHOD: CONSTRUCTOR (NONE)
; --=====================================================================================--
Box_Init PROC uses edi esi lpTHIS:DWORD, INIT_LENGTH:DWORD, INIT_WIDTH:DWORD, INIT_HEIGHT:DWORD
SET_CLASS Box
SetObject edi, Box

PrintText "Box Created"
PrintLine

mov eax, INIT_LENGTH
mov [edi]._Length, eax
mov eax, INIT_WIDTH
mov [edi]._Width, eax
mov eax, INIT_HEIGHT
mov [edi]._Height, eax

ReleaseObject edi
ret
Box_Init ENDP
Posted on 2002-03-14 01:53:28 by Sliver
You can perfectly pass parameters to the init procedure, however we haven't implemented multiple constructors. A workaround could be passing zero to all parameters that should have the default values...

Thomas
Posted on 2002-03-14 02:08:44 by Thomas
Are all variables assumed private or can you output it's value somehow?

ie.



CLASS Shape, Shap
CMETHOD destructor
CMETHOD getArea
CMETHOD setColor
Color dd ?
Shape ENDS


So I could just display the value of "Color" without creating a function such as "getColor" and returning the value in EAX?



Can do:
PrintDec $EAX( hBox, Box, getColor ) ;returns color in eax

but can I do
PrintDec $EAX( hBox, Box, Color ) ;really doubt but you get the idea


I really want a private and public section, but maybe that is a long way off :(

Sliver
Posted on 2002-03-14 20:38:24 by Sliver
It's up to you, asm doesn't care if you pull out a class member variable directly. In other languages, the compiler will prevent this.
Remember that your class pointer is just a pointer to your class structure.


mov eax, lpBox
mov eax, (Box PTR [eax]).Color



Thomas
Posted on 2002-03-15 01:57:23 by Thomas