<?php | |
class ParentClass { | |
protected $a = 1; | |
public function doSomething() { | |
echo "I'm the parent"; | |
$this->a = 2; | |
} | |
} | |
class childClass { | |
public function doSomething() { | |
ParentClass::doSomething(); | |
echo "I'm the child"; | |
echo $this->a; | |
} | |
} | |
$c = new childClass(); | |
$c->doSomething(); |
This comment has been minimized.
This comment has been minimized.
What's so surprising about the result? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Surprising output!
Try to remove line 13.