KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I was wondering if you could help me out.. I have two classes, one extends the other.. Class B will be extended by various different objects and used for common database interactions.. Now I would like class B to handle its connect and disconnects without direction from class A or any external input.. The problem from what I understand is that an extended class won't automatically run its __construct function.. Is there a way around this? Thanks in advance.. class a extends b { public function __construct() { } public function validateStuff() { $this->insert_record(); } } class b { public function __construct() { $this->connect(); } protected function connect() { return true; } public function insert_record() { return true; } }
Tags (comma-separated)
Save Edits
Cancel