Hello sam1600,
Wednesday, January 10, 2001, 9:55:34 PM, you wrote:
sic> Assigning something to $d->somevar when it is not declared in the
sic> definition works fine.
Well, if it still does assign to an undefined class property, I'm not sure
that this behavior will remain in the future since it violates the OOP
paradigm. It looks like a bug, not a feature to me.
I'm not sure that PHP should invent its own OOP style. Once
in the morning after update to a new PHP version you'll find that you
classes won't work anymore if you do such things.
sic> As far as I can tell, and from what we have found here, there is
sic> absolutly no reason whatsoever to define variables in class definitions.
The classes in PHP are intended to be used as a structured data
storage. To use a structure, you should define it first. I guess its
no good to have, e.g. two objects of the same class of completely
different structure.
Btw, there is absolutely no reason to use classes at all with your
approach. OOP code in PHP works slower than plain procedural code,
and if you have no structure, why use classes?
sic> If someone can show me me a reason , other than a pure aesthetics,
sic> why this is nessesary I would sure like to know. If anyone could
sic> show me at least one example where not defining variables in class
sic> definitions would somehow break the class, I would like to see it.
See above.
It's not only an aesthetics. It's a standard. Moreover, it's a common
sense. Try to imagine what will say other developer which may use or
maintain your code looking at this mess.
--
Best regards,
Max A. Derkachev mailto:[EMAIL PROTECTED]
Symbol-Plus Publishing Ltd.
phone: +7 (812) 324-53-53
http://www.Books.Ru -- All Books of Russia
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]