Re: class effeciency
| From: | Nick Wilson | Date: | Thu, 28 Feb 2002 11:12:27 +0000 |
| Subject: | Re: class effeciency | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-86571@lists.php.net to get a copy of this message | ||
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
* and then Simon Willison declared....
> Nick Wilson wrote:
>
> >Is there a better way? It just seems like overkill to include 6-700
> >lines of methods /twice/
> >
> Use inheritance. Define a "base" class with all of the methods in it.
> Then define the two other classes to extend this base class, meaning
> they will have all of the methods you have defined but can implement
> their own variables:
>
> http://www.php.net/manual/en/keyword.extends.php
Hmmm.... another good answer, I'll get right on it.
Thanks Simon.
- --
- -----------------------------------------------------------
www.explodingnet.com | Projects, Forums and
+ Articles for website owners
- -- Nick Wilson -- | and designers.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
iD8DBQE8fhCbHpvrrTa6L5oRArgpAJ9XdY4eyY2rK+I1lesFEbS96Z/CMgCgn+8f
UdoP8r3CoAly+Rubr08VltY=
=e07I
-----END PGP SIGNATURE-----