I am really stuck with this problem.
I have a class “BaseRect” and a Subclass “Field” with BaseRect as Super class.
The BaseRect has a String property “Identifier” which is read only and set only once in the Constructor.
After calling a method with the subclass as parameter the Identifier property gets lost.
The identifier is set in the Constructor of the BaseRect.
The class isn’t touched before and after the method call.
It is already created before and has an Identifier.
Works here with a little example project. When Xojo gets into a state and starts to behave strangely then try a restart of the computer (or clear out the cache by hand) - in my experience a restart of Xojo isn’t enough.
As I said works here with a demo app. Make a demo on your computer and with your Xojo version and see if it works. If it does then step through the code of your project - does it go anywhere else? Search for all occurrences of Identifier. If you have Arbed then check for corruption of the project, or save as text, check, and reimport it into a new project.
And please change that naming convention. It is “variable as class”, and the variable is an INSTANCE, so naming a variable “somethingclass” is just confusing … if anything it should be “somethingInstance” but better just “something”.
i think you cannot replace the actual object rather the byval value. With byref you actualy replace the original even if it’s an object. correct me if i’m wrong.
The moral of the story – ByRef is used when you want to alter the actual item. When its a value type like an integer this alters the value it holds. When its a reference type this would allow you to assign a new instance.