Author Topic: CLASS properties?  (Read 1190 times)

0 Members and 1 Guest are viewing this topic.

Brian Alvarez

  • Guest
CLASS properties?
« 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?

Charles Pegge

  • Guest
Re: CLASS properties?
« Reply #1 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

Brian Alvarez

  • Guest
Re: CLASS properties?
« Reply #2 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.

JRS

  • Guest
Re: CLASS properties?
« Reply #3 on: November 23, 2018, 10:59:03 PM »
In VB, properties are functions that act like assignable objects with rules and limitations.