Node: User-defined Operators in GPC, Next: Data Types in BP and GPC, Previous: Bit; Byte and Memory Manipulation, Up: Borland Pascal
GNU Pascal allows the user to define operators according to the Pascal-SC syntax:
program PXSCOperatorDemo; type Point = record x, y: Real; end; operator + (a, b: Point) c: Point; begin c.x := a.x + b.x; c.y := a.y + b.y; end; var a, b, c: Point = (42, 0.5); begin c := a + b end.
The Pascal-SC operators +>
, +<
, etc. for exact
numerical calculations are not implemented, but you can define them.