[Tutorial] Basic tutorial about class basics
View Single Post
07-23-2008, 09:57 PM
Join Date: Oct 2007
Location: Manchester, UK
Nice work m8.
These variables are called class member variables and you may set a value to them when defining them.
While this may be partly true, they are not bound to a specific name, many people call them object properties or just variables or even attributes, all are valid in my mind. There is nothing mystical about it, they are variables and related functions encapsulated within the instantiated object's (or class's if they are bound to the class like a static) namespace.
Classes are objects which contain methods, member variables, are able to be inherited and much more, objects make our life as developers easier by cutting down on repetitive code.
Not to flog an already dying horse here but I think this point needs stressing, classes are anything but objects they are merely blueprints to an object, much like an architects plans to your house, hence why the 'new' keyword followed by the class name is used to create objects of that class type and the scope resolution operator '::' for static or function/variables bound to the class (i.e. not an object).
Whilst it may be good to be 'technical' and 'picky' about names of class/object functions/variables for a basic tutorial I hardly think its necessary and can be confusing for a new OOP'er to start abstracting names for functions (remember they are still declared using 'function') for a tutorial of this scope its unhelpful.
Aslong as the basic facts are underlined and understood by the reader its done its job.
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
View Public Profile
Send a private message to sketchMedia
Visit sketchMedia's homepage!
Find More Posts by sketchMedia