Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- FiveWin 1.9.2 - January 97 - <b>what is a class</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 What is a Class
--------------------------------------------------------------------------------

  A Class is a group of rules which controls how the Object gets created
  and what the behaviors of those Objects are.

  A Class is something abstract: A collection of immaterial 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 exists in everybodys 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 according to its Class rules!

  How do we create a Class with Clipper ?

  CLASS TWindow

     DATA nTop, nLeft, nBottom, nRight

     METHOD New()  CONSTRUCTOR
     METHOD Display()

  ENDCLASS

  That is the header declaration. 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 has some specific Data!

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


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson