Using extends means that a class IS-A substructure of its parent class(es).

EXAMPLE:

class plant { };
class tree extends plant { };
class apple_tree extends tree { };

apple_tree inherits all methods and attributes from plant and tree
So if there was a methods plant->growth() you can also call it from
tree and apple_tree

IS-A versus HAS-A

apple_tree IS-A tree
apple_tree HAS-A fruit called apple

So apple does not extend apple_tree because it is not a tree

EXAMPLE:

class apple {
var color = 'blue';
var inhabitant = 'worm';
}
class apple_tree extends tree {
var apples = array(new apple());
}

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to