I tried to translate an old PB example for implementing OOP, I didn't succeed, operator ? not supported, is there any other alternative for that?
thanks in advance
Code: Select all
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Structure Rectangle2
*vt
x1.i
x2.i
y1.i
y2.i
EndStructure
Procedure Draw_Rectangle(*this.Rectangle2)
Debug "inside draw"
EndProcedure
Procedure Delete_Rectangle(*this.Rectangle2)
Debug "inside delete"
EndProcedure
Interface Rectangle
Draw()
Delete()
EndInterface
Procedure New_Rect(x1.l, x2.l, y1.l, y2.l)
*Rect.Rectangle2 = AllocateMemory(SizeOf(Rectangle2))
If *Rect
;*Rect\vt = ?RectVT
*Rect\x1 = x1
*Rect\x2 = x2
*Rect\y1 = y1
*Rect\y2 = y2
EndIf
ProcedureReturn *Rect
EndProcedure
OpenWindow(0, 0, 0, 900, 400, "OOP", #PB_Window_SystemMenu)
Rect.Rectangle = New_Rect(0, 10, 0, 20)
Rect\Draw()
Rect\Delete()
DataSection
RectVT:
Data.i @Draw_Rectangle()
Data.i @Delete_Rectangle()
EndDataSection
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;