Flagship is similar to C++ and Class(y), and is fully compatible with Clipper and VisualObjects (VO).
CLASS myScreen // defines a new class
INSTANCE myRow // private to class
PROTECT column // private to class
HIDDEN current // private to class
EXPORT sizeCol := maxcol() // public access allowed
EXPORT sizeRow := maxrow() // public access allowed
METHOD NewSize(y,x) CLASS myScreen // similar tu usual function
sizeRow := y
sizeCol := x
return SELF
METHOD Init(y,x) CLASS myScreen // instantiation, optional params
column := if (ValType(x) == "N", x, column)
myRow := if (ValType(y) == "N", y, myRow )
return SELF
ACCESS Row CLASS myScreen // allows read-only public access
return myRow
ASSIGN Row(y) CLASS myScreen // allows write-only public access
myRow := y
return myRow
// enywhere in the application
//
Local oMyScr := myScreen { 5 } // instantiate/create object variable
? oMyScr:sizeCol, oMyScr:Row // access instances
oMyScr:Row := 20 // assign new value
oMyScr:NewSize (22,50) // invoke method
quit
If you're familiar with C++, you will find a high grade of similarity,
with an easier level of programming: The SELF is equivalent to 'this' in C++,
EXPORT, METHOD, ACCESS and ASSIGN are similar to public: while the other
instances are private:, the declaration 'METHOD NewSize() CLASS myScreen' to
myScreen::NewSize() {..} etc. The access by oMyScr:Row in FS is similar to
oMyScr->Row in C++ and so on.
Of course, inheritances (also from the default classes) and other goodies are supported too.