[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 What is a Class
--------------------------------------------------------------------------------

  A Class is a group of rules wich controls how the Objets get created
  and what are the behaviors of those Objects.


  A Class is something abstract: A collection of inmaterial rules.

  An Object is something real: It is a collection of Data. An Object is
  something material.


  I have a chair. I can touch it. I can use it. The chair exists!

  I speak about 'chairs' with someone. I don't mind what chairs. It is
  a concept that exist on everybody mind. It is an abstraction of the
  material world!


  In computing a Class is a bunch of code -rules for creating and
  managing Objects-.

  In computing an Object is a bunch of Data -real information being
  managed acording to its Class rules!


  How we may create a Class with Clipper ?


  CLASS TWindow

     DATA nTop, nLeft, nBottom, nRight

     METHOD New()  CONSTRUCTOR
     METHOD Display()

  ENDCLASS


  That is the header declaration. There we can see the Data that a Window
  Object will have: nTop, nLeft, nBottom, nRight

  and the behaviors a Window may perform: New() and Display()

  Typically the New() behavior is called a 'CONSTRUCTOR' method as it
  is the way to build a new Object!


  When in our code we do:

  TWindow():New( 3, 3, 20, 40 )

  We are creating an Object!  That Object is a special kind of ARRAY in
  Clipper which have some specific Data!

  That Data can have different values from one Object to another, but it will
  be always the same kind of Data.

  ... continue on our OBJECT commercial product ...

This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson