Reply to Re: getter/setter methods not working

Your name:

Reply:


Posted by Jim Michaels on 10/20/98 11:39

"Jim Michaels" <jmichae3@nospam.yahoo.com> wrote in message
news:JemdnRRZVdJrO3benZ2dnUVZ_tKdnZ2d@comcast.com...
>
> "Ivαn Sαnchez Ortega" <i.punto.sanchez--@rroba--mirame.punto.net> wrote in
> message news:1h20b3-kej.ln1@blackspark.escomposlinux.org...
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> Janwillem Borleffs wrote:
>>
>>> Incorrect constructor name; it should be Lead instead of Leads.
>>
>> Note: In PHP5, it is preferred to name the constructor "__construct"
>> instead
>> of naming it as the class name. That just avoids things like this, you
>> know.
>>
>
> I don't remember seeing that in the manual for a constructor, so how is it
> supported? I see

Never mind. I found this in the user notes. Why isn't stuff like this in
the manuals instead of just the user notes?
<?php
class A { var $value = "Class A\n"; }
class B { var $value = "Class B\n"; }
// Uncomment which extender you want. You can use variables as well.
// define('__EXTENDER__', 'A');
define('__EXTENDER__', 'B');
// Use eval to create a wrapper class.
eval('class EXTENDER extends '. __EXTENDER__ . ' { }');
class C extends EXTENDER
{
function __construct()
{
echo $this->value;
}
}
$t = new C;
?>
Outputs: Class B


>
>
>> - --
>> - ----------------------------------
>> Ivαn Sαnchez Ortega -i-punto-sanchez--arroba-mirame-punto-net
>>
>> Why one contradicts. One often contradicts an opinion when it is really
>> only
>> the way in which it has been presented that is unsympathetic.
>> -- Friedrich Nietzsche [1844 - 1900]
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.2 (GNU/Linux)
>>
>> iD8DBQFD3Vq23jcQ2mg3Pc8RAnBIAJ9rO31gH1aAQcVWRi5S9lwDj0zdMgCgh4YA
>> lsTg11aE545tDFFXlewzApA=
>> =SP+g
>> -----END PGP SIGNATURE-----
>
>

[Back to original message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация