The Point class represents a point in a 2-D coordinate system.
The Point class requires the class definition file oodPlain.cls:
::requires "oodPlain.cls"
Instances of the Point class implement the methods listed in the following table:
+-0-+ +-x-+
>>-.Point~new(--+---+--,--+---+--)-------------------------><
+-x-+ +-y-+The arguments are:
The x coordinate of the point. The default is 0.
The y coordinate of the point. The default is the x coordinate.
This method returns a new Point object.
p = .Point~new(45, 90)
say 'Point p is at ('p~x','p~y')'
say
q = .Point~new(55)
say 'A new point q is at ('q~x','q~y')'
say
q~x = 150
q~y = 300
say 'Changed point q to be at ('q~x','q~y')'
say
::requires 'oodPlain.cls'
/* Output would be:
Point p is at (45,90)
A new point q is at (55,55)
Changed point q to be at (150,300)
*/>>-aPoint~x------------------------------------------------><
Retrieves the x coordinate of the point.
This method takes no arguments
The return value is the x coordinate.
See .Point~new example.
>>-aPoint~x=value------------------------------------------><
Sets the x coordinate of the point
This method has one argument:
The new x coordinate for the point.
This method does not return a value.
See .Point~new example.
>>-aPoint~y------------------------------------------------><
Retrieves the y coordinate of the point.
This method takes no arguments
The return value is the y coordinate of the point.
See .Point~new example.
>>-aPoint~y=value------------------------------------------><
Sets the y coordinate of the point
This method has one argument:
The new y coordinate for the point.
This method does not return a value.
See .Point~new example.