Accessing field in parent object ?

BlitzMax Forums/BlitzMax Programming/Accessing field in parent object ?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

No, not directly. You either need to give TSmallObject a reference to its parent. Or set a pointer to the integer when you create it.

EG:

Type TBigObject

   Field Smaller_Object:TSmallObject
   Field Some_Variable:int = 15

   Method New()
      Smaller_Object=New TSmallObject
      Smaller_Object.Pointer = VarPtr(Some_Variable)
   End Method
End Type

Type TSmallObject
   Field Pointer: Int Ptr
End Type