Linked by John Collins on Wed 21st Apr 2004 06:42 UTC
General Development The purpose of this article is to give a novice programmer the basic idea of what OOP is, as implemented using PHP. Readers should have a basic knowledge of programming ie what variables are, variable types, basic methods of writing comments, and how to enter code into a text editor.
Permalink for comment
To read all comments associated with this story, please click here.
oop
by Anonymous on Wed 21st Apr 2004 10:19 UTC

One of the main featurs in OOP, is the concept of a class as a blackbox. One should not know what is inside the class, or how it is implemented. Thus instead of accessing the data directly trough $person->name it would be much cleaner to have getter/setter for that variable, fe: getName() { return this->name; } and setName($name) { if isValid($name) this->name = $name; else raiseError("invalid name"); }