+ 3

Why here is appeared errors when I RUN

my_parent_self. php file? https://code.sololearn.com/wcrWxd1TZArY/?ref=app

22nd May 2019, 4:31 PM
Egor Tonchev(EGO)
Egor Tonchev(EGO) - avatar
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
22nd May 2019, 4:38 PM
Alessio Benvenuti
Alessio Benvenuti - avatar
+ 5
EGO you are welcome :)
22nd May 2019, 5:51 PM
Alessio Benvenuti
Alessio Benvenuti - avatar
+ 3
That's right. Thank You very much!!!
22nd May 2019, 5:48 PM
Egor Tonchev(EGO)
Egor Tonchev(EGO) - avatar