Posted by Janwillem Borleffs on 09/18/05 01:22
Janwillem Borleffs wrote:
> class MyClass2 {
> var $x = 2;
> static $y;
>
> function __construct() {
> $this->y = $this->x;
> }
> }
>
Bad example as $y is set as a normal class property instead of a static. In
general, statics should be assigned with hardcoded values if you want to
access them directly without creating an instance of the class first.
JW
Navigation:
[Reply to this message]
|