Jump to content

oops problem


Jaswinder

Recommended Posts

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 :-

 

<?php
class 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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.