Hello, been searching for about a day now trying to figure out if this is possible. No luck 🙂
I have three classes - c extends b and b extends a - now getting a var from a to b, is easy... getting one from b to c, seems impossible.
Lets make a quick example, so you can understand me.
class a {
protected $var;
$this->var = 'some value';
public function a() { // do something }
}
class b extends a {
protected $somevar;
$this.>somevar = 'some value 2';
public function b() { // do something else }
}
class c extends b {
public function c() {
echo parent:: $this->var; // this works
echo parent:: $this->somevar; // this gives an error
}
}
what i need is for $this->somevar to be read inside class c - how is this done? I'm sure it has to be possible, but how? 🙂
Been playing around with getting the parent class and i can get a name, but:
parent:: $this->var; // found
// lets say i have gotten the name of b, so b being class b
b:: $this->somevar; // not found
Any helps appreciated 😃