A simple program
Here is a simple program that creates an instance of the RegPolygon class, changes the length of a side, and displays the perimeter:
// Polygon.prg
// A simple program example
//
local poly
poly = new RegPolygon( )
poly.length = 4
? poly.perimeter( ) // Displays 12
class RegPolygon
this.sides = 3 // Default number of sides
this.length = 1 // and default length
function perimeter( )
return this.sides * this.length
endclass