Re: Re: overiding functions (constructors mostly)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Exactly Daniel ! I should've mentioned that too. Thanx for making it clear.


On Mon, 25 Oct 2004 15:45:36 +0200, Daniel Schierbeck <dasch@xxxxxxxxxx> wrote:
> M Saleh Eg wrote:
> > OR you could control ur method and have optional arguments in ur
> > argument list and decide what to do according to that.
> >
> > e.g. public function _construct($param1=0, $param2="", $param3=null)
> > {
> >    if($param1)
> >    ....
> >
> >    if($param2)
> >    ....
> >
> >    if($param3)
> >    ....
> > }
> >
> > $obj=new className(1);
> > //Or
> > $obj=new className(1,"hello");
> > //Or
> > $obj=new className(0,"","some_value");
> >
> > Bottom Line:
> > Optional arguments might be a workaround lack of polymorphism sometimes !
> >
> 
> Better use
> 
>        if (isset($param1)) { ...
> 
> then, otherwise values such as 0 will cause difficulties.
> 
> --
> 
> 
> Daniel Schierbeck
> 
> Help spread Firefox (www.getfirefox.com):
> http://www.spreadfirefox.com/?q=user/register&r=6584
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
M.Saleh.E.G
97150-4779817

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux