Re: Class Properties in Interfaces?

From: Date: Wed, 30 Apr 2008 06:37:15 +0000
Subject: Re: Class Properties in Interfaces?
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.internals 
Request: Send a blank email to internals+get-37334@lists.php.net to get a copy of this message
$hair = new Hair(); $hair->colour = 'brown';
You can do this without pre-defining any properties.
The above is a much less wordy way of doing the following:
No, it is not the same. You can override what happens when you do setColor - like send notification to some other object or set also matching color for the shoes, etc. :) but you can't have any behavior attached to setting value.
This is a feature of a dynamic language, not a flaw in my argument. And
Not having rigid definitions of properties is also a feature of dynamic language ;) -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#37334) next »