"chris" <someone@here.com> wrote in message
news:3fd89047$1@funnel.arach.net.au...[color=blue]
> What is a class ?? is it like a function ??[/color]
A function is a collection of statements.
When a function is "called" by program code it can be fed data (the function
parameters) which the statements will process to "return" a result, the
function's return value.
A class is a collection of variables together with some functions which set
the values of those variables.
Classes are an integral part of "Object Oriented Programming".
The Basic of the '80s was NOT object oriented.
A class always has at least one function called its "constructor".
Calling this function results in the formation of one "instance" of the
class.
A class instance is known as an "object".
To work with an object you need to obtain a block of memory to store it in.
You do this by using the "new" operator.
This operator returns a pointer to the block of memory where the object will
be stored
e.g. in javascript there is a class called an array.
I would guess the array class consists of the constructor function plus a
dynamic array variable.
The constructor function, called Array(), returns an object which consists
of an array the contents of which are determined by the parameters fed to
the constructor.
Calling the constructor might look like this:
weekday=new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
weekday is an object that consists of an array of the days of the week.
One book I have read likened an object to a cookie (real edible cookies -
not the kind you find on the web) and a class to a cookie cutter. The
definition of the class determines the shape of the object.
The PHP manual describes it thus:
"Classes are types, that is, they are blueprints for actual variables. You
have to create a variable of the desired type with the new operator. "
Check it out in the manual for yourself
www.php.net/oop
HTH
Orson