FutureBasic Logo

<<    Index    >> FutureBasic 5

override   statement



Syntax:
override local fn fnName
override Runtime fnName
override _constantName = newValue


Description:
When used to redefine a function, or Runtime, the override command instructs the compiler to begin using a new address for a specific routine. The new version must contain the same parameters as the older version. If no older version exists the function is created.

The following example overrides FutureBasic's Print statement by putting print marks around everything that is printed.

override Runtime PrintString
  call DrawString("""")
  fn FBPrintString // DrawString(gFBStr&.FBStrAcc$)
  call DrawString("""")
End fn


The override statement may also be used to change the value of a constant.
override _someConst = someValue

Note:
When you override a constant, any code compiled after the override is affected. Constants are not variables. They are only examined at compile time. It is therefore not possible to override a constant that is used in the runtime since FutureBasic has already compiled the entire runtime before your override is ever encountered.