Hello all
Made some minutes ago this little class example and its Working well
' simple class example with data
' by frank bruebach, oxygen, 16-04-2024
'
' Oxygen Class example
'
' how I can make a salary add for john with 500 euros?
'
class Employee
string names2
string depts2
integer salarys2
method constructor(String name1="John", string dept1="Computer Lab", integer salary=2000)
names2 = name1
depts2 = dept1
salarys2 = salary
print "construct!"
End method
method destructor()
===================
'destroy bstrings
del names2
del depts2
del salarys2
print "destruct!"
end method
method act() as string
======================
return names2 ", " depts2 ", " salarys2
end method
end class
new Employee john("John","Computer Lab", 2000)
print john.act
del john
' how I can make a salary add for john with 500 euros?
[
How I can make a salary increase for John with 500 Euros?
Solved :)
' simple class example2 with data
' by frank bruebach, oxygen, 16-04-2024
'
' Oxygen Class example
'
' how I can make a salary add for john with 500 euros?
'
class Employee
string names2
string depts2
integer salarys2
method constructor(String name1="John", string dept1="Computer Lab", integer salary=2000)
names2 = name1
depts2 = dept1
salarys2 = salary
print "construct!"
End method
method destructor()
===================
'destroy bstrings
del names2
del depts2
del salarys2
print "destruct!"
end method
method act() as string
======================
return names2 ", " depts2 ", " salarys2
end method
method act2() as string
======================
return names2 ", " depts2 ", " salarys2+500
end method
end class
new Employee john("John","Computer Lab", 2000)
print john.act
print john.act2
del john
When using Powerbasic Classes, to get B-String Parameters into Threads,I found that when opening and destroying classes, there is some memory Leak in Powerbasic. therefore it an not be used for all cases.
I wonder it would work better in O2, getting String and other Parameters inside Threads and out of there.
I would be very cautious about creating and destroying things in the correct order. O2 does not have any built-in thread functions, so you have to use the Windows kernel thread API. Only local variables are inherently thread-safe.
QuoteWindows kernel thread API.
Yes it is the safest way to use API
i try to use it once but i am not impressed with performance
well maybe this depend on used processor..i am not sure.
Maybe Thread functions that can have all sorts of IN/OUT Parameters would be a great feature that beats Powerbasic as it currently is.