Oxygen Basic
Programming => Bugs & Feature Requests => Topic started by: pber on June 23, 2014, 03:21:03 AM
-
...this causes a gpf to me
Am I wrong?
class provider
s1 as string
method getString() as string
return s1
end method
end class
class user
s2 as string
method setString(s as string)
s2=s
end method
end class
provider o1
o1.s1="123"
user o2
' just do this,
o2.s2 = o1.s1
' but using methods instead of directly accessing members
o2.setString(o1.getString()) ' XXX breaks
-
Hi Paolo,
If you pass the string byval, it will work. I will remedy this problem, which I suspect is between the function returning the string and the expectation of a string parameter to be passed byref.
class user
s2 as string
method setString(byval s as string)
s2=s
end method
end class
or simply:
class user
s2 as string
method setString(string s)
s2=s
end method
end class
-
Hi Charles,
Does it mean that:
1) method m( id as type ) is implicitly myRef
2) method m( type id ) is implicitly byVal
?
-
Yes, byref is the default when using the old 'as' syntax
-
...now it works :-*
tnx