Using an objects constants
Steve Hicks (N5AC)
Posts: 20
I have an object that has some parameters that are "mode switches."· The value being passed in determines how the function will handle the other data.· I would like to define these as constants in a CON section such as
CON
· rateSlow = 4800
· rateFast = 9600
.....
OBJ
· myObject: "myObject"
PUB Start
· myObject.Init (rateSlow)
My problem is that I seem to have to define these (constants) in both the object used as well as the program using the object.· Is this correct?· Is there an elegant way to do this other than extracting the constant section out of the object in use and pasting it in the consumer of the object?
Thanks,
Steve
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Steve, N5AC
CON
· rateSlow = 4800
· rateFast = 9600
.....
OBJ
· myObject: "myObject"
PUB Start
· myObject.Init (rateSlow)
My problem is that I seem to have to define these (constants) in both the object used as well as the program using the object.· Is this correct?· Is there an elegant way to do this other than extracting the constant section out of the object in use and pasting it in the consumer of the object?
Thanks,
Steve
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Steve, N5AC
Comments
You can use the notation Object#rateSlow to do just what you're after. (See page 141 of the manual.)
-Phil
Steve
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Steve, N5AC