Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class GrandClass {
- public $data;
- public function __construct() {
- $this->someMethodInTheParentClass();
- }
- public function someMethodInTheParentClass() {
- $this->$data = 123456;
- }
- }
- class MyParent extends GrandClass{
- public function __construct() {
- parent::__construct();
- }
- }
- class Child extends MyParent {
- // public $data;
- public function __construct() {
- parent::__construct();
- }
- public function getData() {
- return $this->data;
- }
- }
- $a = new Child();
- var_dump($a->getData());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement