Re: classes v. functions

From: Date: Fri, 18 Jul 2003 21:36:46 +0000
Subject: Re: classes v. functions
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-155846@lists.php.net to get a copy of this message
Chris Shiflett wrote: > --- Andu <undo@archeopterix.com> wrote: > > This may show my ignorance or my refusal to take for granted > > something I don't fully understand but I have a hard time > > figuring out the advantage of using classes as opposed to just > > functions. > > They are entirely different. While OO fans will find my over-simplification > disgusting, a class is basically a way to associate data with the functions > that manipulate that data. > > Chris > AKA 'encapsulation' Of course you can achieve this by making a programmer imposed requirement saying that global variable X can only be altered by function Xf(), or Typedef X can only be altered by functions Xf(), but OO make this more of a hard requirement, and not the programmer imposed or 'soft' requirement. Of course there are other ideas like polymorphism and inheritance and such. Just google for Object oriented programming, and read some of the numerous exposes on the subject to get a general idea. http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=object+oriented+programming -Brad

« previous php.general (#155846) next »