Quantcast
Channel: Xojo Programming Forum - Latest topics
Viewing all articles
Browse latest Browse all 3816

Conversion from a Variant to a subclass through return is not done and does a RuntimeError

$
0
0

I have a problem.

When using the Return statement, the conversion of a subclass of an empty array doesn’t work.

Function Test_Array() As cSuperClass()
  Var vObjects() As cSubClass
  Var vVariant As Variant
  
  vVariant = vObjects // Prove you can convert an array of objects to a Variant
  vObjects = vVariant // Prove you can convert Variant containing an array of objects to the original objects’ array
  
  Return vObjects // works
  Return vVariant // doesn’t work
End Function

But if I do the same with just an object, all works well…

Function Test_Object() As cSuperClass
  Var vObject As cSubClass
  Var vVariant As Variant
  
  vVariant = vObject
  vObject = vVariant
  
  Return vObject // works
  Return vVariant // works
End Function

This limitation is written no where in the doc. Is it a bug, as I am assuming?

Regards, Antoine

17 posts - 5 participants

Read full topic


Viewing all articles
Browse latest Browse all 3816

Trending Articles