I'm currently trying to create a form class for an application, and am wondering exactly how to go about it. What I am after is a Class named 'Form' that is composed of several other Classes, such as 'TextBox' and 'Button', that is extendable, so that I can have a sub class named 'UserForm' that inherits all of the 'Form' Class's properties, i.e. 'TextBox'.
How is this Composition/Aggregation best achieved in PHP? Would I create Classes within Classes? I.e.
class Form {
function Form() { // constructor
}
class TextBox {
function TextBox() { // creates a text box
// some code
}
}
class Button {
function Button() { // creates a button
// some code
}
}
}
Is it even possible?
Regards.
Steve.