Interactive PowerBasic Forum

IT-Consultant: Charles Pegge => OxygenBasic Examples => Topic started by: Charles Pegge on February 02, 2025, 04:11:08 AM

Title: Functions inside Functions, Classes inside Functions
Post by: Charles Pegge on February 02, 2025, 04:11:08 AM
More encapsulation:

'FUNCTIONS INSIDE FUNCTIONS
function f1() as int
  function f2() as int
    static int i
    i++
    return i
  end function 'f2
  int j
  j=f2()
  return j
end function 'f1
print f1()
'print f2() 'not found

'CLASSES INSIDE FUNCTIONS
function ff()
  type tt
    float x,y,z
    method mm()
      print "mm"
    end method
  end type
  tt t
  t.mm()
end function
ff()

Title: Re: Functions inside Functions, Classes inside Functions
Post by: Zlatko Vid on February 02, 2025, 03:42:01 PM
cool  ;)