Jump to content

jamesishereto

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

jamesishereto's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. So is there another way to change the output given by the function in A by changing a const or var or something in B? This code gets me what I need but is there a more sensible way to do so? [code] <?php class A {          protected $value = 'Original';          function display() {              echo $this->value;                  }          } class B extends A {     protected $value = 'Contemporary';      } $B = new B(); $B->display(); ?> [/code]
  2. Hi. I was wondering if there is any way in the given example below for the original display function to still perform the same function but using the redefined constant from the second class? Thanks, James [code] class A { const MYCONST = 'abc'; function display() { echo A::MYCONST; } } class B extends A { const MYCONST = 'def'; } [/code]
×
×
  • 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.