|  | Posted by Jim Michaels on 06/12/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-----
 >
 >
  Navigation: [Reply to this message] |