Hello.
- Can I avoid instantiate a Db object inside of Names object to access it anyways?
- Would __autoload work for that?
- Is there another smart solution?
I have following classes (They are conceptual so they won't work if executed):
Db {
function connect($config) {
// connect to data base
}
function query($query) {
// Process a query
}
}
Names {
function show_names($query) {
$Db = new Db(); // Is it possible to autoload this object?
$Db->query(query);
// Print data
}
}