KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I need a parent class to access its child properties: class Parent { private $_fields = null; public function do_something() { // Access $_fields and $child_var here } } class Child extends Parent { private $child_var = 'hello'; } $child = new Child(); $child->do_something(); When $_fields is modified from the child scope, it's still null in the parent scope. When trying to access $child_var from parent scope using $this->child_var , it's of course undefined. I didn't find anything like a "function set" that would just be copied in the child class...
Tags (comma-separated)
Save Edits
Cancel