View Single Post
Old 12-07-2007, 09:15 PM   #1 (permalink)
bdm
The Acquainted
Good Samaritan 
 
Join Date: Nov 2007
Posts: 127
Thanks: 14
bdm is on a distinguished road
Default Constructor in an abstract class?

Is it safe to do the following:
PHP Code:
abstract class Db_Adapter_Abstract {
    public function 
__construct($config) {
        
$this->connect($config);
    }

    abstract protected function 
connect($config);

It works since I've tested it. But I have this funny feeling on how it shouldn't be done. Since all my database adapters will have a common constructor, I figure it's alright to do.

What are your thoughts?

Thank you.
bdm is offline  
Reply With Quote
The Following User Says Thank You to bdm For This Useful Post:
ReSpawN (12-07-2007)