Jaarrrggghhhh,
 
Ye all be getting into the spirit of talk like a pirate day ;-)
 
You can also access the overridden method in a parent class/object by super.countIt() inside count it (or anywhere for that matter). Super is just like this but the super class (as the name would suggest).
 
Like everything, inheritence has a time and a place over composition. The tighter coupling of components can make the solution more complicated than it needs to be and reduce usabilty. The more specific child classes can give you a higher level of cohesion as it makes the method calls more uniform as the specialised class (component) does only a specialised task (but does it well). I guess this is why some OO people say never use inheritence as composition decreases coupling and increases cohesion.
 
The issue with super only being able to access the parent is really a non-issue as if the child class needs to access a parent method and also needs to access its grandparents method, then the parent would most likely need (or should be) accessing the its parent anyway otherwise you will be ending up with duplicated redundant code (I hope that makes sense).
 
Shane
 
On 9/19/06, christophe albrech <[EMAIL PROTECTED]> wrote:
arrrrgh. well said me hearty

On 9/19/06, Barry Beattie < [EMAIL PROTECTED]> wrote:

>
> He's talking about a scenario where inheritence goes up more than one level.
>
aye

parent->child->grandchild

> The OO guy in me does ask tho - is this something that *has* to be
> done through inheritence, or can it be done throuhg composition?

aye, aye. that be what I wuz drivin'  at.

shiver me timbers.
barry.b




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cfaussie" group.
To post to this group, send email to cfaussie@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cfaussie
-~----------~----~----~----~------~----~------~--~---

Reply via email to