Jaswinder Posted June 11, 2013 Share Posted June 11, 2013 hello friends i am new to oops.... what i am trying is put the value of a constant in a variable... but not getting any output code :- <?phpclass visible{ const a='Hello';}class check extends visible{ private $c; public function c() { $this->c=self::a; }}$d=new check;echo $d->c();?> is it possible to inherent a constant ?? Link to comment https://forums.phpfreaks.com/topic/279021-oops-problem/ Share on other sites More sharing options...
Psycho Posted June 11, 2013 Share Posted June 11, 2013 What do you expect to be echo'd? All the method "c" is doing is assigning a value to a variable. It isn't returning anything. Link to comment https://forums.phpfreaks.com/topic/279021-oops-problem/#findComment-1435266 Share on other sites More sharing options...
Jaswinder Posted June 11, 2013 Author Share Posted June 11, 2013 ok ..so this means .. i am not returning the variable in function .. thank you problem solved @ Psycho Link to comment https://forums.phpfreaks.com/topic/279021-oops-problem/#findComment-1435392 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.