Welcome to Part II of the series "Inheritance and Polymorphism in PHP: Building a Form Generator." I really hope that you found the concepts explained in the first part useful. As you may recall, in part I we introduced the OOP arena in PHP, using the capabilities of Inheritance for creating an extensible form generator.
Stepping back to refresh our memories, we defined a base form object class and derived each subclass that defines the bare bones for each form element. For the complete list of classes, please take a look at the first article, to quickly grasp how they were structured. It's fairly simple.
In this second article, we will get a bit more complex. We're going to complete the source code for each class definition, having an overall concept of the mechanism to make the form generator work properly.
So, it's time to show our work in progress and fully define the subclasses for each form element. Let's get started.