Oxygen Basic

Information => Development => Topic started by: Brian Alvarez on November 23, 2018, 05:00:55 PM

Title: CLASS properties?
Post by: Brian Alvarez on November 23, 2018, 05:00:55 PM
 Can classes in oxygen contain properties?

I would like to do something like this:

Code: [Select]
Ob.prop(1,2,3) = 123
 Is this possible?
Title: Re: CLASS properties?
Post by: Charles Pegge on November 23, 2018, 09:27:10 PM
o2 does not have a separate category of property, but it supports pseudo-assignment.

Code: [Select]
class cc
  '
  int a[1000]
  '
  function prop(int i,j,k, v) 'SET
  int d=i+j*10+k*100
  a[d]=v
  end function

  function prop(int i,j,k) as int 'GET
  int d=i+j*10+k*100
  return a[d]
  end function
  '
end class

cc c
c.prop(1,2,3)=21
int x=c.prop(1,2,3)
print x
Title: Re: CLASS properties?
Post by: Brian Alvarez on November 23, 2018, 10:52:51 PM
 I think that is the exact behavior of a property module Charles... i dont mind the name, but
i am curious... why didnt you add the name "property"? You are kind of... already there.
Title: Re: CLASS properties?
Post by: JRS on November 23, 2018, 10:59:03 PM
In VB, properties are functions that act like assignable objects with rules and limitations.