Hey guys,
I've got a couple questions that hopefully can be answered...
1. OBJPTR, What would you use this for. You can't assign the pointer to an object so what is the intended use?
2. Is there any native way to copy only the instance variables between two different objects of the same interface type? Or should this be done with a user defined "Copy" method.
3. Is it possible to create a generic interface variable which can be assigned an interface type at run time.
4. When creating an array of object interfaces, is the following a "safe" way to use the ARRAY INSERT/DELETE statements?
Thanks!
I've got a couple questions that hopefully can be answered...
1. OBJPTR, What would you use this for. You can't assign the pointer to an object so what is the intended use?
2. Is there any native way to copy only the instance variables between two different objects of the same interface type? Or should this be done with a user defined "Copy" method.
Code:
dim Object1 as IObject dim Object2 as IObject Object1 = class "CObject" Object2 = class "CObject" Object1.InstanceVars = Object2.InstanceVars
Code:
dim Record as IGeneric select case lRecordType case %RECORD_ADDRESS redim Record as IAddress Record = class "CAddress" case %RECORD_PERSON redim Record as IPerson Record = class "CPerson" case %RECORD_COMMENTS redim Record as IComments Record = class "CComments" end select
Code:
dim Record(10) as IRecord dim lRow as long for lRow = 0 to ubound(Record) Record(lRow) = class "CRecord" next 'Allocate DWORD array over object array dim RecordIndex(ubound(Record)) as dword at varptr(Record(0)) 'Destroy object reference at row 5 Record(5) = nothing 'Delete array element 5 using array delete array delete RecordIndex(5)
Thanks!
Comment