Mac: Sequoia
Xojo: 2024 Release 4.1
As I understand it, in Xojo, class instances are always passed by reference. I took this to mean that it was arbitrary as to whether or not you included ByRef or not.
I prefer a verbose coding style, so I tried writing a Method that had a class instance as one of the parameters
cnIsotropic is a subclass of Canvas that I have written.
The Method had two parameters: iPosition As Integer, ByRef some_cnvIsotropic As cnIsotropic
This results in an error: You can’t pass an expression as a parameter that is defined as ByRef
If I remove the word, ByRef, then the error goes away, and it works as expected. I am puzzled by this. I thought that presence or absence of ByRef would be irrelevant in that class instances are always passed by reference. Can somebody provide an explanation?
11 posts - 5 participants