... | ... | @@ -21,7 +21,15 @@ 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.
|
|
|
|
|
|
1.5 demonstrate that autoloading of your classes works. note that it is now recommended to use spl_autoload_register() rather than __autoload() http://php.net/manual/en/language.oop5.autoload.php
|
|
|
1.5 demonstrate that autoloading of your classes works. note that it is now recommended to use spl_autoload_register() rather than __autoload() http://php.net/manual/en/language.oop5.autoload.php.
|
|
|
Here's an example of how it works:
|
|
|
```
|
|
|
spl_autoload_register(function ($class_name) {
|
|
|
$class_name = strtolower($class_name);
|
|
|
include $class_name . '.class.php';
|
|
|
});
|
|
|
```
|
|
|
Put this near the top of your script, not in the class itself.
|
|
|
|
|
|
|
|
|
|