starting object oriented php
this lab will make a start with object oriented (oo) php. this lab has three exercises.
- creating some simple classes so you're happy with the syntax etc
- making a database class to access the record store database
- creating an oo version of a file upload script
1. basic classes
1.1 the basic definition is given in the php manual http://php.net/manual/en/language.oop5.basic.php create a class for an object of your choice (person, pet, planet - it's up to you). define a few attributes and methods. write a script that instantiates this class and invokes one of its methods.
1.2 add a constructor __construct() to your class to set some attributes when it is first created (see http://php.net/manual/en/language.oop5.decon.php)
1.3 inheritance in php is specified here: http://php.net/manual/en/language.oop5.inheritance.php extend your class in two ways, and show that you can use them.
1.4 overriding in php (modifying an inherited method) is easy: you just need to create method with same name in your child class which you want to override. Do this for your two new classes and demonstrate that you have created two different methods which are invoked the same way.