To add to the below, object classes, can have their own set of functions, called 
methods.  These methods are specific to the function, and ALL functions within a class 
treat any properties (variables) within the class as global.

So if you have a class "Car" with two properties ("Make" and "Model"), then those two 
properties can be readily accessible to any method within the class.  At least I think 
that's how it works.  I'm not all that knowledgeable on the subject :o)

Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/


>>> "Jay Blanchard" <[EMAIL PROTECTED]> 07/16/02 10:51AM >>>
[snip]
Could someone please explain the difference between classes and functions
and how to use a class. I write alot of PHP, but I never understood this at
all. I use an include statement in many of my pages and include a file with
a bunch of functions. For instance, I might have a function called stock();
In the page I am using I include the file that has this function and I call
it like this:

stock($Sym);

I am wondering if I am doing it the wrong way. So I need to better
understand classes. What is one, and why would you use it?
[/snip]

A class is the representation of an object, such as a person, place, or
thing.
A function is a group of commands that can be called for a specific purpose.

function addNumbers()

A function can be performed on an object, but an object (the logical
extension of class) cannot be performed on a function. Does that help?

Jay

"Cleverly disguised as a responsible adult"

*************************************
* Want to meet other PHP developers *
* in your area? Check out:          *
* http://php.meetup.com/            *
* No developer is an island ...     *
*************************************



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php 



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to