Problem when approaching
I have a class like this with overloaded constructors
the code
<?php /* Users Abstract Class */ abstract class User { protected $user_email; protected $user_username; protected $user_password; protected $registred_date; //Default constructor function User() { } //overloded constructor function User($input_username,$input_email,$input_password) { __set($this->user_username,$input_username); __set($this->user_email,$user_password); __set($this->user_password,$input_password); } } ?>
Problem Details
The above code contains the error: error:Fatal error: Cannot redeclare User::User()
Like other languages, such as C ++ and Java, use the above approach to overload constructors, how to do it in PHP OOP ?
Additional Information
Im using * PHP 5.3.2 in LAMP * which OOP concepts should be fully supported in this version
Sudantha
source share