but you can define a static helper function.
Only usefull if you need to know how many active instances exists.
(i need it for thread control inside of a audio engine)
Joshy
Code: Select all
type TESTCLASS
enum JOBS
_DEC = -1
_GET
_INC
end enum
declare constructor
declare destructor
declare static function NumberOfInstances(job as JOBS=_GET) as integer
private:
as integer dummy
end type
type PTESTCLASS as TESTCLASS ptr
constructor TESTCLASS
NumberOfInstances _INC
end constructor
destructor TESTCLASS
NumberOfInstances _DEC
end destructor
function TESTCLASS.NumberOfInstances(job as JOBS) as integer
static as integer nInstances=0
nInstances+=job:return nInstances
end function
dim as PTESTCLASS a = new TESTCLASS
with *a : ? .NumberOfInstances : end with
dim as TESTCLASS b,c
with b : ? .NumberOfInstances : end with
with c : ? .NumberOfInstances : end with
delete a
with b : ? .NumberOfInstances : end with
with c : ? .NumberOfInstances : end with
sleep