Extends problem

BlitzMax Forums/BlitzMax Beginners Area/Extends problem

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

One last thing. When you see the line "Function Create:TSwitch(name_in$)" it means this to the compiler:

"Function" = I'm going to create a new function now, inside this object.

"Create:TSwitch" = This function will be named "Create" and will return an object of the type "TSwitch"

"(name_in$)" = This function will have to be passed a parameter with will be in the form of characters, and it will be stored in the local string variable called "name_in"

Then when I calle the Function in my program, I use "Global myobject:TSwitch = TSwitch.Create("First")". The compiler reads this to mean:

"Global myobject:TSwitch=" = I am creating a global variable (of type TSwitch) to store the returned object from the create function. This is optional, but useful if you want to do something else to that object, before you lose it and can only get to it through the List. It could be Local instead of Global, depending on what you are going to do to it.

"TSwitch.Create" = I'm telling the compiler to go into the Type TSwitch and perform the function called Create. If I want to use a method, I would call the method through the variable (i.e. myobject.update()), but Functions are called by Type.

"("First")"= I'm telling the compiler to send the characters F I R S T into the function, where we know they will be stored in a temporary string variable named "name_in". I could have also sent a string variable in, i.e.:

Local data_in$ = "First"
Global myobject:TSwitch = TSwitch.Create(data_in).

Hope this explains what is happening...