RE: [PHP-GENERAL] could someone help me a bit w/ php classes?
| From: | Webmaster | Date: | Wed, 24 May 2000 17:21:05 +0000 |
| Subject: | RE: [PHP-GENERAL] could someone help me a bit w/ php classes? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-444@lists.php.net to get a copy of this message | ||
Check Luis Argerich article, "OO Programming in PHP"
http://www.phpbuilder.com/columns/luis20000420.php3?&print_mode=1
I get this code from there:
<?php
class Myclass {
function Myclass() {
$name= "Myclass".func_num_args();
$this->$name();
//Note that $this->$name() is usually wrong but here
//$name is a string with the name of the method to call.
}
function Myclass1($x) {
code;
}
function Myclass2($x,$y) {
code;
}
}
?>
Good luck!
Eduardo Jordán G.
Webmaster
-----Original Message-----
From: Andrew White [SMTP:andyw@pixeltrix.co.uk]
Sent: Wednesday, May 24, 2000 12:03 PM
To: PHP-General
Subject: Re: [PHP-GENERAL] could someone help me a bit w/ php classes?
> I'm just wondering if php supports overloading... ie:
No, but you can achieve a similar effect using default values, e.g:
class Table {
..
function Table( $w = 0 ) {
$this->$width = $w;
}
Andrew
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net