Re: note 9419 added to Classes and Objects
| From: | J. M. Castagnetto | Date: | Fri, 03 Nov 2000 23:15:43 +0000 |
| Subject: | Re: note 9419 added to Classes and Objects | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-7355@lists.php.net to get a copy of this message | ||
No need for overloading, as the parameters are not
hard-typed. This *is* a scripting language after all
;-)
Just make a method that supports a variable number of
parameters, or use function_get_args,
function_num_args. Check the manual for more info an
examples.
Use the resources listed in the "Support" section of
php.net for this type of questions. Your note has been
removed by one of the editors.
--- joris@dl2.org wrote:
> Overloading of the constructor of a class... is it
> possible? (it would be very helpfull indeed)
>
> as far as I've noticed, it isn't.
> --------------------------------
> class foo {
> var $a;
> var $b;
>
> // default constructor
> function foo () {
> $this->a = 'default';
> $this->b = 'default';
> }
>
> // copy constructor
> function foo($otherfoo) {
> $this->a = $otherfoo->a;
> $this->b = $otherfoo->b;
> }
>
> // init constructor
> function foo ($_a, $_b) {
> $this->a = $_a;
> $this->b = $_b;
> }
> }
>
> Oh how I miss C++.... *grin*
>
> does anyone have a workaround,
> or is this just something php
> is missing?
>
> http://www.php.net/manual/language.oop.php
>
>
> --
> PHP Notes Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
> php-notes-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-notes-help@lists.php.net
> To contact the list administrators, e-mail:
> php-list-admin@lists.php.net
>
=====
--- Jesus M. Castagnetto (jcastagnetto@yahoo.com)
__________________________________________________
Do You Yahoo!?
From homework help to love advice, Yahoo! Experts has your answer.
http://experts.yahoo.com/