Jaswinder Posted June 11, 2013 Share Posted June 11, 2013 (edited) 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 ?? Edited June 11, 2013 by Jaswinder Quote Link to comment Share on other sites More sharing options...
Solution Psycho Posted June 11, 2013 Solution 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. Quote Link to comment 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.