Ich experimentiere mit der Funktion Interface herum.
Es gibt dort, genauso wie bei Structure, ein "Extends" um ein vorhandenes Interface zu erweitern.
Das vTable (also die Definition der einzelnen Interfaceprozeduren) liegt in einer DataSection.
Kleines Beispiel:
Code: Alles auswählen
Interface iInterface
Free.i()
EndInterface
Structure s_iInterface
vTable.i
EndStructure
Procedure.i _Free(*this.s_iInterface)
EndProcedure
DataSection
vTable_iInterface:
Data.i @_Free()
EndDataSection
klappt das. Meine Frage nun :
Wenn ich ein Interface mit Extends "erweiter", wie muss dann die DataSection und das "vTable" aussehen ?
Wieder eine Anschauung :
Code: Alles auswählen
Interface iInterface
Free.i()
EndInterface
Interface iInteger Extends iInterface
Get.i()
Neu.i()
EndInterface
Interface iString Extends iInterface
Neu.s()
EndInterface
Structure s_iInterface
vTable.i
EndStructure
Procedure.i _Free(*this.s_iInterface)
EndProcedure
Procedure.i _GetInteger(*this.s_iInterface)
EndProcedure
Procedure.i _NeuInteger(*this.s_iInterface)
EndProcedure
Procedure.s _NeuString(*this.s_iInterface)
EndProcedure
Procedure.i CreateInteger()
Protected *this.s_iInterface = AllocateStructure(s_iInterface)
If *this
*this\vTable = ; ?
EndIf
ProcedureReturn *this
EndProcedure
Procedure.i CreateString()
Protected *this.s_iInterface = AllocateStructure(s_iInterface)
If *this
*this\vTable = ; ?
EndIf
ProcedureReturn *this
EndProcedure
DataSection
vTable_iInterface:
Data.i @_Free()
; ?
EndDataSection
Und ich denke das "Extends" genau dafür gemacht wurde.