Class Inheritance for basic framework

Discussion in 'PHP' started by LazyD, Apr 13, 2008.

  1. #1
    Im looking to build a very basic framework for my projects. Part of that is building an OO based system to assist in that.

    Currently, for all of the new classes (Sections) I make, im having to add all of the other classes I want to use in it manually.

    What im looking for, is a way, using classes and inheritance to create a central Class that the rest of my classes will extend. The central Class will have all of the other classes included so I make available, all of the other classes in the app. Example as follows:

    PrimaryClass
    has Database Class (Class has a function inside called doStuff)
    has General Class
    has Other Class

    TestClass extends PrimaryClass
    Should be able to do parent::DatabaseClass::doStuff()

    Is this possible?

    Again, to reiterate, I want to make a primary class that uses __construct to include ALL other classes, then I would like to be able extend that class for all of my other Classes. Is this possible?
     
    LazyD, Apr 13, 2008 IP
  2. LazyD

    LazyD Peon

    Messages:
    425
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Anyone at all?

    Does no one know about Classes/Objects here?
     
    LazyD, Apr 15, 2008 IP
  3. bdude

    bdude Peon

    Messages:
    124
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You could have your PrimaryClass use __autoload functions to automatically load the classes upon initialisation. Unfortunately, PHP does not support multiple inheritence.
     
    bdude, Apr 16, 2008 IP