+ 3
Why here is appeared errors when I RUN
my_parent_self. php file? https://code.sololearn.com/wcrWxd1TZArY/?ref=app
3 Réponses
+ 5
EGO
on line 7 remove the semicolon
working code:
<?php
//Class access
class Ancestr
{
const NAME="Ancestr";
function __construct()
{
print "In".self::NAME."constructor\n";
}
}
class Kid extends Ancestr
{
const NAME="Kid";
function __construct()
{
parent::__construct(); print "In".self::NAME."constructor\n";
}
}
$object=new Kid();
//outputs In Ancestr constructor
//outputs:In Kid constructor
?>
I hope I was helpful
+ 5
EGO you are welcome :)
+ 3
That's right. Thank You very much!!!