View Full Version : Using an objects constants

Steve Hicks (N5AC)
11-06-2006, 02:42 AM
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

rateSlow = 4800
rateFast = 9600


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?



Steve, N5AC

Phil Pilgrim (PhiPi)
11-06-2006, 02:45 AM

You can use the notation Object#rateSlow to do just what you're after. (See page 141 of the manual.)


Steve Hicks (N5AC)
11-06-2006, 02:50 AM
Thanks, Phil! Just what I was looking for. I always read the manual for a new part cover to cover which I did this time, but I must have forgotten by the time I got to the end!



Steve, N5AC