I have two classes that I use to access two different tables in my db. They both have a similar constructor that looks like that:
function __construct($db) {
    $this->db = $db;
    $userDAO = DAO_DBrecord::createUserDAO($this->db);
    $this->userDAO = $userDAO;
}
The other class has the same constructor except that it uses createOtherTableDAO($this->db).
I am planning on having a couple other such classes, and it would be convenient if I could have them all inherit the same constructor, and pass createAppropriateTableDAO as an argument.
To clarify, in the first case above, createUserDAO($this->db) is a static function that calls a constructor in my DAO class.  The function in the DAO looks as follows:
public static function createUserDAO($db) {
    return new DAO_DBrecord($db, 'users');
}
I use this method to make sure the user model can only call a DAO on the users table.
I'm somewhat of a beginner, and I don't think I have ever seen anything like what I want.
 
     
     
     
     
     
    