Hi all,
I have just purchased Dark Basic Pro and I am having a few problems adjusting from my Visual Basic .Net way of doing things. I hope someone here can give me some advice.
One of the problems I have encountered is in trying to write a function that takes as it's arguments 2 user defined types and alters the state of one of them.
Firstly is there any way that a function can alter the value of an argument and have that alteration visible from outside the function? In VB this would be accomplished by passing a reference to the argument rather than a copy of it, and therefore anything done to the variable from within the function would be visible outside the function.
If this is not possible in DB Pro then I would like to be able to have my function return the updated user defined type,so can anyone explain why the following doesn't work and fails during compilation with the error 'Both user defined type values must use the same type'
Rem Contrived example of problem
TYPE MyType
Var1 as integer
ENDTYPE
mt1 as MyType
mt2 as MyType
mt1.var1=10
mt2.var1=20
mt1=DoStuff(mt1,mt2)
FUNCTION DoStuff(Arg1 as MyType,Arg2 as MyType)
Arg1.Var1=Arg2.Var1+1
ENDFUNCTION Arg1
I hope I have explained this in a way that makes sense to all you DB Pro gurus out there and I hope you can help. I have to say that I am finding my first few days of programming with DB Pro terribly frustrating; I was looking forward to getting to grips with 3D graphics but I seem to be spending all my coding time working around the inadequacies of the basic syntax.
Does anyone know of a good book for someone who is experineced in programming but new to DB pro?
Thanks for taking the time to read this,
Regards,
Legarto.