Does PureBasic have an object/container similar to an R dataframe
Does PureBasic have an object/container similar to an R dataframe
R has an object called a dataframe which is basically a matrix which allows columns of different data types. So for instance gender (character / factor) and age (numeric). You can append columns and you can easily overwrite columns with formulas. What is the closest to that in PureBasic. Arrays perhaps?
- NicTheQuick
- Addict
- Posts: 1226
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: Does PureBasic have an object/container similar to an R dataframe
Maybe an in-memory database with sqlite?
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Re: Does PureBasic have an object/container similar to an R dataframe
Thanks I'll give a try.
Re: Does PureBasic have an object/container similar to an R dataframe
Overwriting data types is not supported by Purebasic.
But you can also create your own data types as a structure.
Example times as Object. (Update)
But you can also create your own data types as a structure.
Example times as Object. (Update)
Code: Select all
;-TOP
; Module DataSet by mk-soft, v1.01.1, date 24.09.2021
DeclareModule DataSet
Interface iDataSet
Free()
SetW(Key.s, Value.w)
SetL(Key.s, Value.l)
SetI(Key.s, Value.i)
SetQ(Key.s, Value.q)
SetF(Key.s, Value.f)
SetD(Key.s, Value.d)
SetStr(Key.s, Value.s)
Get(Key.s)
GetF.f(Key.s)
GetD.d(Key.s)
GetStr.s(Key.s, Decimals=2)
GetType(Key.s)
EndInterface
Declare New()
EndDeclareModule
Module Dataset
Structure udtAny
Type.w
StructureUnion
wVal.w
lVal.l
iVal.i
qVal.q
fltVal.f
dblVal.d
EndStructureUnion
sVal.s
EndStructure
Structure udtDataSet
*vTable
Map Value.udtAny()
EndStructure
; ----
Procedure New()
Protected *r1.udtDataSet
*r1 = AllocateStructure(udtDataSet)
If *r1
*r1\vTable = ?vTable
Else
Debug "Error " + #PB_Compiler_Module + "/" + #PB_Compiler_Procedure + ": Out of Memory!"
EndIf
ProcedureReturn *r1
EndProcedure
Procedure Free(*DataSet)
If *DataSet
FreeStructure(*DataSet)
EndIf
EndProcedure
; ----
Procedure SetW(*DataSet.udtDataSet, Key.s, Value.w)
If Not FindMapElement(*DataSet\Value(), Key)
If Not AddMapElement(*DataSet\Value(), key)
Debug "Error " + #PB_Compiler_Module + "/" + #PB_Compiler_Procedure + ": Out of Memory!"
ProcedureReturn #False
EndIf
EndIf
*DataSet\Value()\Type = #PB_Word
*DataSet\Value()\sVal = #Null$
*DataSet\Value()\wVal = Value
EndProcedure
Procedure SetL(*DataSet.udtDataSet, Key.s, Value.l)
If Not FindMapElement(*DataSet\Value(), Key)
If Not AddMapElement(*DataSet\Value(), key)
Debug "Error " + #PB_Compiler_Module + "/" + #PB_Compiler_Procedure + ": Out of Memory!"
ProcedureReturn #False
EndIf
EndIf
*DataSet\Value()\Type = #PB_Long
*DataSet\Value()\sVal = #Null$
*DataSet\Value()\lVal = Value
EndProcedure
Procedure SetI(*DataSet.udtDataSet, Key.s, Value.i)
If Not FindMapElement(*DataSet\Value(), Key)
If Not AddMapElement(*DataSet\Value(), key)
Debug "Error " + #PB_Compiler_Module + "/" + #PB_Compiler_Procedure + ": Out of Memory!"
ProcedureReturn #False
EndIf
EndIf
*DataSet\Value()\Type = #PB_Integer
*DataSet\Value()\sVal = #Null$
*DataSet\Value()\wVal = Value
EndProcedure
Procedure SetQ(*DataSet.udtDataSet, Key.s, Value.q)
If Not FindMapElement(*DataSet\Value(), Key)
If Not AddMapElement(*DataSet\Value(), key)
Debug "Error " + #PB_Compiler_Module + "/" + #PB_Compiler_Procedure + ": Out of Memory!"
ProcedureReturn #False
EndIf
EndIf
*DataSet\Value()\Type = #PB_Quad
*DataSet\Value()\sVal = #Null$
*DataSet\Value()\qVal = Value
EndProcedure
Procedure SetF(*DataSet.udtDataSet, Key.s, Value.f)
If Not FindMapElement(*DataSet\Value(), Key)
If Not AddMapElement(*DataSet\Value(), key)
Debug "Error " + #PB_Compiler_Module + "/" + #PB_Compiler_Procedure + ": Out of Memory!"
ProcedureReturn #False
EndIf
EndIf
*DataSet\Value()\Type = #PB_Float
*DataSet\Value()\sVal = #Null$
*DataSet\Value()\fltVal = Value
EndProcedure
Procedure SetD(*DataSet.udtDataSet, Key.s, Value.d)
If Not FindMapElement(*DataSet\Value(), Key)
If Not AddMapElement(*DataSet\Value(), key)
Debug "Error " + #PB_Compiler_Module + "/" + #PB_Compiler_Procedure + ": Out of Memory!"
ProcedureReturn #False
EndIf
EndIf
*DataSet\Value()\Type = #PB_Double
*DataSet\Value()\sVal = #Null$
*DataSet\Value()\dblVal = Value
EndProcedure
Procedure SetStr(*DataSet.udtDataSet, Key.s, Value.s)
If Not FindMapElement(*DataSet\Value(), Key)
If Not AddMapElement(*DataSet\Value(), key)
Debug "Error " + #PB_Compiler_Module + "/" + #PB_Compiler_Procedure + ": Out of Memory!"
ProcedureReturn #False
EndIf
EndIf
*DataSet\Value()\Type = #PB_String
*DataSet\Value()\qVal = 0
*DataSet\Value()\sVal = Value
EndProcedure
; ----
Procedure.q Get(*DataSet.udtDataSet, Key.s)
Protected r1.q
If FindMapElement(*DataSet\Value(), Key)
Select *DataSet\Value()\Type
Case #PB_Word
r1 = *DataSet\Value()\wVal
Case #PB_Long
r1 = *DataSet\Value()\lVal
Case #PB_Integer
r1 = *DataSet\Value()\iVal
Case #PB_Quad
r1 = *DataSet\Value()\qVal
Case #PB_Float
r1 = *DataSet\Value()\fltVal
Case #PB_Double
r1 = *DataSet\Value()\dblVal
Case #PB_String
r1 = Val(*DataSet\Value()\sVal)
EndSelect
ProcedureReturn r1
Else
ProcedureReturn 0
EndIf
EndProcedure
Procedure.f GetF(*DataSet.udtDataSet, Key.s)
Protected r1.f
If FindMapElement(*DataSet\Value(), Key)
Select *DataSet\Value()\Type
Case #PB_Word
r1 = *DataSet\Value()\wVal
Case #PB_Long
r1 = *DataSet\Value()\lVal
Case #PB_Integer
r1 = *DataSet\Value()\iVal
Case #PB_Quad
r1 = *DataSet\Value()\qVal
Case #PB_Float
r1 = *DataSet\Value()\fltVal
Case #PB_Double
r1 = *DataSet\Value()\dblVal
Case #PB_String
r1 = ValF(*DataSet\Value()\sVal)
EndSelect
ProcedureReturn r1
Else
ProcedureReturn 0
EndIf
EndProcedure
Procedure.d GetD(*DataSet.udtDataSet, Key.s)
Protected r1.d
If FindMapElement(*DataSet\Value(), Key)
Select *DataSet\Value()\Type
Case #PB_Word
r1 = *DataSet\Value()\wVal
Case #PB_Long
r1 = *DataSet\Value()\lVal
Case #PB_Integer
r1 = *DataSet\Value()\iVal
Case #PB_Quad
r1 = *DataSet\Value()\qVal
Case #PB_Float
r1 = *DataSet\Value()\fltVal
Case #PB_Double
r1 = *DataSet\Value()\dblVal
Case #PB_String
r1 = ValD(*DataSet\Value()\sVal)
EndSelect
ProcedureReturn r1
Else
ProcedureReturn 0
EndIf
EndProcedure
Procedure.s GetStr(*DataSet.udtDataSet, Key.s, Decimals=2)
Protected r1.s
If FindMapElement(*DataSet\Value(), Key)
Select *DataSet\Value()\Type
Case #PB_Word
r1 = Str(*DataSet\Value()\wVal)
Case #PB_Long
r1 = Str(*DataSet\Value()\lVal)
Case #PB_Integer
r1 = Str(*DataSet\Value()\iVal)
Case #PB_Quad
r1 = Str(*DataSet\Value()\qVal)
Case #PB_Float
r1 = StrF(*DataSet\Value()\fltVal, Decimals)
Case #PB_Double
r1 = StrD(*DataSet\Value()\dblVal, Decimals)
Case #PB_String
r1 = *DataSet\Value()\sVal
EndSelect
ProcedureReturn r1
Else
ProcedureReturn ""
EndIf
EndProcedure
Procedure GetType(*DataSet.udtDataSet, Key.s)
If FindMapElement(*DataSet\Value(), Key)
ProcedureReturn *DataSet\Value()\Type
Else
ProcedureReturn 0
EndIf
EndProcedure
; ----
DataSection
vTable:
Data.i @Free()
Data.i @SetW()
Data.i @SetL()
Data.i @SetI()
Data.i @SetQ()
Data.i @SetF()
Data.i @SetD()
Data.i @SetStr()
Data.i @Get()
Data.i @GetF()
Data.i @GetD()
Data.i @GetStr()
Data.i @GetType()
EndDataSection
EndModule
; ****
CompilerIf #PB_Compiler_IsMainFile
Global.DataSet::iDataSet *Set1, *Set2
*set1 = DataSet::New()
*set1\SetStr("FirstName", "Michael")
*set1\SetStr("LastName", "Mustermann")
*set1\SetStr("Age", "xxx")
Debug "Type " + *Set1\GetType("Age")
; Overwrite Age
*set1\SetI("Age", 55)
Debug "Type " + *Set1\GetType("Age")
Debug *set1\GetStr("FirstName")
Debug *set1\GetStr("LastName")
Debug *set1\GetStr("Age")
; DateSet key exits
Debug *set1\GetType("Number")
*set1\Setd("Number", 12.345678)
Debug *Set1\GetStr("Number", 4)
CompilerEndIf
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Does PureBasic have an object/container similar to an R dataframe
Thanks, I won't pretend to understand any of that but will go through the manual to see.mk-soft wrote: ↑Fri Sep 24, 2021 12:44 pm Overwriting data types is not supported by Purebasic.
But you can also create your own data types as a structure.
Example times as Object. (Update)
Code: Select all
;-TOP ; Module DataSet by mk-soft, v1.01.1, date 24.09.2021 DeclareModule DataSet Interface iDataSet Free() SetW(Key.s, Value.w) SetL(Key.s, Value.l) SetI(Key.s, Value.i) SetQ(Key.s, Value.q) SetF(Key.s, Value.f) SetD(Key.s, Value.d) SetStr(Key.s, Value.s) Get(Key.s) GetF.f(Key.s) GetD.d(Key.s) GetStr.s(Key.s, Decimals=2) GetType(Key.s) EndInterface Declare New() EndDeclareModule Module Dataset Structure udtAny Type.w StructureUnion wVal.w lVal.l iVal.i qVal.q fltVal.f dblVal.d EndStructureUnion sVal.s EndStructure Structure udtDataSet *vTable Map Value.udtAny() EndStructure ; ---- Procedure New() Protected *r1.udtDataSet *r1 = AllocateStructure(udtDataSet) If *r1 *r1\vTable = ?vTable Else Debug "Error " + #PB_Compiler_Module + "/" + #PB_Compiler_Procedure + ": Out of Memory!" EndIf ProcedureReturn *r1 EndProcedure Procedure Free(*DataSet) If *DataSet FreeStructure(*DataSet) EndIf EndProcedure ; ---- Procedure SetW(*DataSet.udtDataSet, Key.s, Value.w) If Not FindMapElement(*DataSet\Value(), Key) If Not AddMapElement(*DataSet\Value(), key) Debug "Error " + #PB_Compiler_Module + "/" + #PB_Compiler_Procedure + ": Out of Memory!" ProcedureReturn #False EndIf EndIf *DataSet\Value()\Type = #PB_Word *DataSet\Value()\sVal = #Null$ *DataSet\Value()\wVal = Value EndProcedure Procedure SetL(*DataSet.udtDataSet, Key.s, Value.l) If Not FindMapElement(*DataSet\Value(), Key) If Not AddMapElement(*DataSet\Value(), key) Debug "Error " + #PB_Compiler_Module + "/" + #PB_Compiler_Procedure + ": Out of Memory!" ProcedureReturn #False EndIf EndIf *DataSet\Value()\Type = #PB_Long *DataSet\Value()\sVal = #Null$ *DataSet\Value()\lVal = Value EndProcedure Procedure SetI(*DataSet.udtDataSet, Key.s, Value.i) If Not FindMapElement(*DataSet\Value(), Key) If Not AddMapElement(*DataSet\Value(), key) Debug "Error " + #PB_Compiler_Module + "/" + #PB_Compiler_Procedure + ": Out of Memory!" ProcedureReturn #False EndIf EndIf *DataSet\Value()\Type = #PB_Integer *DataSet\Value()\sVal = #Null$ *DataSet\Value()\wVal = Value EndProcedure Procedure SetQ(*DataSet.udtDataSet, Key.s, Value.q) If Not FindMapElement(*DataSet\Value(), Key) If Not AddMapElement(*DataSet\Value(), key) Debug "Error " + #PB_Compiler_Module + "/" + #PB_Compiler_Procedure + ": Out of Memory!" ProcedureReturn #False EndIf EndIf *DataSet\Value()\Type = #PB_Quad *DataSet\Value()\sVal = #Null$ *DataSet\Value()\qVal = Value EndProcedure Procedure SetF(*DataSet.udtDataSet, Key.s, Value.f) If Not FindMapElement(*DataSet\Value(), Key) If Not AddMapElement(*DataSet\Value(), key) Debug "Error " + #PB_Compiler_Module + "/" + #PB_Compiler_Procedure + ": Out of Memory!" ProcedureReturn #False EndIf EndIf *DataSet\Value()\Type = #PB_Float *DataSet\Value()\sVal = #Null$ *DataSet\Value()\fltVal = Value EndProcedure Procedure SetD(*DataSet.udtDataSet, Key.s, Value.d) If Not FindMapElement(*DataSet\Value(), Key) If Not AddMapElement(*DataSet\Value(), key) Debug "Error " + #PB_Compiler_Module + "/" + #PB_Compiler_Procedure + ": Out of Memory!" ProcedureReturn #False EndIf EndIf *DataSet\Value()\Type = #PB_Double *DataSet\Value()\sVal = #Null$ *DataSet\Value()\dblVal = Value EndProcedure Procedure SetStr(*DataSet.udtDataSet, Key.s, Value.s) If Not FindMapElement(*DataSet\Value(), Key) If Not AddMapElement(*DataSet\Value(), key) Debug "Error " + #PB_Compiler_Module + "/" + #PB_Compiler_Procedure + ": Out of Memory!" ProcedureReturn #False EndIf EndIf *DataSet\Value()\Type = #PB_String *DataSet\Value()\qVal = 0 *DataSet\Value()\sVal = Value EndProcedure ; ---- Procedure.q Get(*DataSet.udtDataSet, Key.s) Protected r1.q If FindMapElement(*DataSet\Value(), Key) Select *DataSet\Value()\Type Case #PB_Word r1 = *DataSet\Value()\wVal Case #PB_Long r1 = *DataSet\Value()\lVal Case #PB_Integer r1 = *DataSet\Value()\iVal Case #PB_Quad r1 = *DataSet\Value()\qVal Case #PB_Float r1 = *DataSet\Value()\fltVal Case #PB_Double r1 = *DataSet\Value()\dblVal Case #PB_String r1 = Val(*DataSet\Value()\sVal) EndSelect ProcedureReturn r1 Else ProcedureReturn 0 EndIf EndProcedure Procedure.f GetF(*DataSet.udtDataSet, Key.s) Protected r1.f If FindMapElement(*DataSet\Value(), Key) Select *DataSet\Value()\Type Case #PB_Word r1 = *DataSet\Value()\wVal Case #PB_Long r1 = *DataSet\Value()\lVal Case #PB_Integer r1 = *DataSet\Value()\iVal Case #PB_Quad r1 = *DataSet\Value()\qVal Case #PB_Float r1 = *DataSet\Value()\fltVal Case #PB_Double r1 = *DataSet\Value()\dblVal Case #PB_String r1 = ValF(*DataSet\Value()\sVal) EndSelect ProcedureReturn r1 Else ProcedureReturn 0 EndIf EndProcedure Procedure.d GetD(*DataSet.udtDataSet, Key.s) Protected r1.d If FindMapElement(*DataSet\Value(), Key) Select *DataSet\Value()\Type Case #PB_Word r1 = *DataSet\Value()\wVal Case #PB_Long r1 = *DataSet\Value()\lVal Case #PB_Integer r1 = *DataSet\Value()\iVal Case #PB_Quad r1 = *DataSet\Value()\qVal Case #PB_Float r1 = *DataSet\Value()\fltVal Case #PB_Double r1 = *DataSet\Value()\dblVal Case #PB_String r1 = ValD(*DataSet\Value()\sVal) EndSelect ProcedureReturn r1 Else ProcedureReturn 0 EndIf EndProcedure Procedure.s GetStr(*DataSet.udtDataSet, Key.s, Decimals=2) Protected r1.s If FindMapElement(*DataSet\Value(), Key) Select *DataSet\Value()\Type Case #PB_Word r1 = Str(*DataSet\Value()\wVal) Case #PB_Long r1 = Str(*DataSet\Value()\lVal) Case #PB_Integer r1 = Str(*DataSet\Value()\iVal) Case #PB_Quad r1 = Str(*DataSet\Value()\qVal) Case #PB_Float r1 = StrF(*DataSet\Value()\fltVal, Decimals) Case #PB_Double r1 = StrD(*DataSet\Value()\dblVal, Decimals) Case #PB_String r1 = *DataSet\Value()\sVal EndSelect ProcedureReturn r1 Else ProcedureReturn "" EndIf EndProcedure Procedure GetType(*DataSet.udtDataSet, Key.s) If FindMapElement(*DataSet\Value(), Key) ProcedureReturn *DataSet\Value()\Type Else ProcedureReturn 0 EndIf EndProcedure ; ---- DataSection vTable: Data.i @Free() Data.i @SetW() Data.i @SetL() Data.i @SetI() Data.i @SetQ() Data.i @SetF() Data.i @SetD() Data.i @SetStr() Data.i @Get() Data.i @GetF() Data.i @GetD() Data.i @GetStr() Data.i @GetType() EndDataSection EndModule ; **** CompilerIf #PB_Compiler_IsMainFile Global.DataSet::iDataSet *Set1, *Set2 *set1 = DataSet::New() *set1\SetStr("FirstName", "Michael") *set1\SetStr("LastName", "Mustermann") *set1\SetStr("Age", "xxx") Debug "Type " + *Set1\GetType("Age") ; Overwrite Age *set1\SetI("Age", 55) Debug "Type " + *Set1\GetType("Age") Debug *set1\GetStr("FirstName") Debug *set1\GetStr("LastName") Debug *set1\GetStr("Age") ; DateSet key exits Debug *set1\GetType("Number") *set1\Setd("Number", 12.345678) Debug *Set1\GetStr("Number", 4) CompilerEndIf
Re: Does PureBasic have an object/container similar to an R dataframe
Hello,
Purbasic's help is already very good, but it doesn't say everything. Sorry, but I didn't think that you are still a beginner with Purebasis.
Even if Purebasic is procedure oriented, you can program object oriented. Unfortunately, there is not enough information about this in the help.
What is an object. An object is a pointer to a memory. The first entry in this memory is a pointer to a table containing the addresses of the functions and methods. When calling the functions and methods, the first parameter is ALWAYS the pointer to the own object (memory). Purebasic does this internally.
An interface is the description of the functions and methods. The table and the interface must have the same order.
This also applies to accessing objects from Windows.
Good time
Michael
Purbasic's help is already very good, but it doesn't say everything. Sorry, but I didn't think that you are still a beginner with Purebasis.
Even if Purebasic is procedure oriented, you can program object oriented. Unfortunately, there is not enough information about this in the help.
What is an object. An object is a pointer to a memory. The first entry in this memory is a pointer to a table containing the addresses of the functions and methods. When calling the functions and methods, the first parameter is ALWAYS the pointer to the own object (memory). Purebasic does this internally.
An interface is the description of the functions and methods. The table and the interface must have the same order.
This also applies to accessing objects from Windows.
Good time
Michael
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Re: Does PureBasic have an object/container similar to an R dataframe
Okay that is good to know. Perhaps there is a book out there on PureBasic that goes into more detail.mk-soft wrote: ↑Fri Sep 24, 2021 5:31 pm Hello,
Purbasic's help is already very good, but it doesn't say everything. Sorry, but I didn't think that you are still a beginner with Purebasis.
Even if Purebasic is procedure oriented, you can program object oriented. Unfortunately, there is not enough information about this in the help.
What is an object. An object is a pointer to a memory. The first entry in this memory is a pointer to a table containing the addresses of the functions and methods. When calling the functions and methods, the first parameter is ALWAYS the pointer to the own object (memory). Purebasic does this internally.
An interface is the description of the functions and methods. The table and the interface must have the same order.
This also applies to accessing objects from Windows.
Good time
Michael
EDIT: I found this book, there is a lot more detail on arrays there. I see in fact there are multidimensional arrays that can be updated.http://purearea.net/pb/download/PureBasicBook.pdf
Re: Does PureBasic have an object/container similar to an R dataframe
There is a video tutorial on Udemy on OOP with PureBasic but it's in French. Although I'm from the United States, I can understand French - I have a degree in French Literature . It would be super cool if that video were transcribed to English.
Cheers,
Gary
Cheers,
Gary
Gary E Chike DMD MS
'Experience is what you get when you don't get what you want'
'Experience is what you get when you don't get what you want'
Re: Does PureBasic have an object/container similar to an R dataframe
Just another more basic example.
If you dont want to re-read what was already mentioned/explained before skip to the code.
A object is 'just' a datastructure in memory where the first member of the structure is a pointer to
a virtual function table (vtable) that holds all the functions of the object.
The first parameter of any function within the vtable is always a reference to (the object) itself.
Thats pretty much all there is to it.
Example:
This is very useful for complex stuff.
If you dont want to re-read what was already mentioned/explained before skip to the code.
A object is 'just' a datastructure in memory where the first member of the structure is a pointer to
a virtual function table (vtable) that holds all the functions of the object.
The first parameter of any function within the vtable is always a reference to (the object) itself.
Thats pretty much all there is to it.
Example:
Code: Select all
EnableExplicit
Structure OBJECT
*vt;<- pointer to the virtual function table
message.s;<- object holds a string
EndStructure
Procedure.i vtHello(*obj.OBJECT);<- function (of the object) to display the message
ProcedureReturn MessageRequester("Info",*obj\message)
EndProcedure
Procedure.i vtRelease(*obj.OBJECT);<- function (of the object) to clean up (release itself)
ProcedureReturn FreeStructure(*obj)
EndProcedure
Procedure.i CreateObject();<- function to create an object
Protected *obj.OBJECT
*obj = AllocateStructure(OBJECT);<- create the object
If *obj
*obj\vt = ?vtable;<- link the virtual function table (vtable)
*obj\message = "Hello World!";<- initialize stuff within the object
EndIf
ProcedureReturn *obj
EndProcedure
Interface OBJ;<- the interface that describes the functions of our object
Hello.i()
Release.i()
EndInterface
Procedure.i Main()
Protected *obj.OBJ
*obj = CreateObject();<- creates the object
*obj\Hello();<- calls the Hello() function of the object
*obj\Release();<- releases the object
ProcedureReturn #Null
EndProcedure
Main()
End
DataSection
vtable:;<- just a place to store the vtable (could be anywhere even inside the object itself)
Data.i @vtHello()
Data.i @vtRelease()
EndDataSection
Re: Does PureBasic have an object/container similar to an R dataframe
If OOP, then like every window object an IUnknown interface. But you don't necessarily have to if you stay with PB internally ...
Link: How to create IUnknown interface
Link: How to create IUnknown interface
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive