A question about types
Blitz3D Forums/Blitz3D Beginners Area/A question about types
| ||
Can you do this?Type hi Field hi=1 End Type |
| ||
Yea? but generaly thats not how types work.. more like this: Graphics 300,500,16,2 setbuffer backbuffer() type person field Hello$ end type Bob.person = new person Bob\Hello="Hello" Joe.person = new person Joe\Hello="Yo Wazzup?" Dumbguy.person = new person Dumbguy\Hello="Duhh..." Print "Dumbguy's Hello: "+Dumbguy\Hello Print "Joe's Hello: "+Joe\Hello Print "Bobs Hello: "+Bob\Hello delay 5000 |
| ||
Although you could do it, I would very much recomend not nameing the type the field and the instance the same thingHi.Hi = New Hi print Hi\hiIs just anoying codeing Unless you were just asking if you can allocate a field directly, in which case yep no probs |
| ||
Well, this is why I want to do it: http://www.blitzbasic.com/Community/posts.php?topic=69694 I want to complete this in as very little code as possible. |
| ||
Types can't have default values in Blitz3D, can they? |
| ||
Types can't have default values in Blitz3D, can they? No, they can't - although, I think the compiler allows you to put 'Field a=1' etc., it just doesn't have any effect. |
| ||
;--------- type Scans Field code Field ID$ end type for i=0 to 222 ; the amount of SC's i think Codes.Scans = new Codes Codes\ID="ScanCode#"+i next Somthing like that i suppose..? |
| ||
The compiler lets you, but sometimes it bugs up and requests a file to open if you give a custom function eg type box field contents% = CreateList%() end type |