Hi!
Is there a way of having multiple constructors in a class?
For example, say I have a class:
class A
{
var $m_sFirstname;
var $m_sLastname;
function A( $aData )
{
$this->m_sFirstname = $aData["firstname"];
$this->m_sLastname = $aData["lastname"];
}
function A( $sFirstname, $sLastname )
{
$this->m_sFirstname = $sFirstname;
$this->m_sLastname = $sLastname;
}
}
Now I can create an instance of this class with:
$inst = new A( "Bill", "Clinton" );
But the following lines will yeld an error:
$a = array( "firstname" => "Billd", "lastname" => "Clinton" );
$inst = new A( $a );
"Missing argument 2 for a() ..."
Why is that?