Posted by Kesavan on 03/01/07 06:29
I need polymorphism in php.
When I run this following code I get the following error.
Fatal error: Cannot redeclare aClass::aPrint() in C:\Program Files
\xampp\htdocs\k7\prCls.php on line 16
How I rectify it?
<?php
class aClass{
function aPrint($name){
echo $name;
}
function aPrint($name,$age){
echo $name;
echo $age;
}
}
$myClass = new aClass;
$myClass->aPrint('Kesavan');
$myClass2 = new aClass;
$myClass2->aPrint('Kesavan',24);
?>
/
********************************************************************************************************/
Kesavan M
m.kesavan@hotmail.com
[Back to original message]
|