On Wed, Jun 23, 2010 at 02:58, Rene Veerman <[email protected]> wrote:
> inheritance of this kind is useful if you have common descendants for
> specific types of object
>
Nice thought. I imagine something like a DB wrapper, and implementing things
such as multiqueries and others on an extension based on the basic
connection made in the "original" class. Am I right on that?
> another use, is a modification of a certain component.
> descend it from the parent object and override the functions.
> you can do pre processing and post processing by overriding functions.
>
So, you're saying I can do something like this? :
class foo {
function hello($a = '') {
echo 'hello '.$a;
}
}
class bar extends foo {
function hello($a = '') {
if (!empty($a)) parent::hello($a);
else echo 'bye world';
}
}
$xx = new bar();
$xx->hello('asdf');
$xx->hello();
Which will print (hopefully, haven't test it yet):
hello asdf
bye world
That would be really a nice way of updating certain vital apps, without
breaking basic functionality.
Thanks for your answer :)
Greetings !!
--
Mailed by:
UnReAl4U - unreal4u
ICQ #: 54472056
www1: http://www.chw.net/
www2: http://unreal4u.com/