Multiple Inheritance Question
Posted: Wed Sep 08, 2010 4:51 am
Hello fellow programmers. I'm trying to really get into OOP and learning the best practices to manage and structure my code correctly.
I have an app that has several classes for back end operations like form generation and database queries.
I would like to be able to create a new class, have it extend a base class that has access to all my backend classes.
So I could achieve something like this:
database would be my database handling class. And forms would be my form generation class. Any ideas how I can achieve this? Or is there a better way this can be done?
I have an app that has several classes for back end operations like form generation and database queries.
I would like to be able to create a new class, have it extend a base class that has access to all my backend classes.
So I could achieve something like this:
Code: Select all
class App {
public $database = new Database(); //new Database class instance
public $forms = new Forms(); //New Forms class instance
}
class test extends App {
function test() {
$this->database->function(parameters);
$this->forms->function(parameters);
}
}