From: George H. <geo...@us...> - 2006-03-13 14:16:56
|
Update of /cvsroot/win32forth/win32forth/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11615/win32forth/doc Modified Files: p-objects.htm Log Message: gah: More Dexing and added missing section of doc. Index: p-objects.htm =================================================================== RCS file: /cvsroot/win32forth/win32forth/doc/p-objects.htm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** p-objects.htm 21 Dec 2004 00:18:56 -0000 1.1 --- p-objects.htm 13 Mar 2006 14:16:49 -0000 1.2 *************** *** 153,158 **** </p> <blockquote> ! <pre>:Class Disk </pre> ! </blockquote> <h3><a name="Creating and Deleting Dynamic Objects">Creating and Deleting Dynamic Objects </a> </h3> --- 153,210 ---- </p> <blockquote> ! <pre>:Class Disk <Super Object ! ! int cylinders ! int sectors ! int b/sec ! 32 bytes disk-name ! ! :M ClassInit: ( -- ) ! 0 to cylinders ! 0 to sectors ! 0 to b/sec ;M ! ! :M !Attributes: ( cyl sec b/sec -- ) ! to b/sec ! to sectors ! to cylinders ;M ! ! :M Attributes: ( -- cyl sec b/sec ) ! cylinders ! sectors ! b/sec ;M ! ! :M FreeBytes: ( -- freebytes ) ! cylinders sectors * b/sec * ;M ! ! ;Class ! </pre> ! </blockquote><p> ! Now that we have define the class, we can create an object of the class ! as follows;</p> ! <blockquote><pre> ! Disk myDisk1 ! 1024 32 512 !Attributes: myDisk1 ! </pre></blockquote><p> ! Here we have defined an object called "myDisk", and given this new disk ! the attributes of: cylinders=1024, sectors=32, b/sec=512</p> ! <p> So ":Class" and ";Class" encompass a collection of data items and ! methods that define and identify an object and the way it behaves. ! The word "int" defines a local data item similar to a "value" that is ! local to each object created by a class. A second data type available ! for use within a class is "bytes", which was used to create a buffer to ! hold the disk name.</p> ! <p> ! The "ClassInit:" method is special in the sense that it is ! automatically executed right after the object is created. So it is a ! perfect place to initialize an object to the common default values that ! are shared by all objects of this class.</p> ! <p> ! Additional methods, (their names always end with a ':' so they can be ! identified as methods) can be defined in your class to initialize, ! display, calculate, or perform whatever type of operation you will need ! to perform on the objects of this class.</p> ! ! <h3><a name="Creating and Deleting Dynamic Objects">Creating and Deleting Dynamic Objects </a> </h3> *************** *** 234,238 **** <blockquote> <p><span class="MacroChar"> :Class DirObject ! <super <br><br> Record: FIND_DATA \ returns the address of the --- 286,290 ---- <blockquote> <p><span class="MacroChar"> :Class DirObject ! <super object<br><br> Record: FIND_DATA \ returns the address of the |