Hi All,
Can I get an opinion on something that must be pretty common, but that I've never heard a name for..........
This is the best analogy I can give so here goes......
Say you have a YARD object. It contains 5 German Shepards objects - the only kind it will ever contain.
However, the YARD object will leash the 1st shepard right near its gate. The other 4 will be leashed further back. For these 4, YARD will wrap and provide to its users: YardDogBark() and YardDogHowl().
The first dog, however, will be wrapped to include YardDogBite(), since it is right near the gate.
I know in terms of inheritance, a derived class is never supposed to "diminish" the ability of the base class, only augment or supplement it.
But YARD contains the dogs. So is it a common / acceptable thing for a wrapping class to wrap MORE of 1 multiply contained object than it does of the others?, thereby making one of the multiple objects somehow different than the others?
Not sure if this breaks any hiding rules like it would for inheriting.
thanks, joe
Can I get an opinion on something that must be pretty common, but that I've never heard a name for..........
This is the best analogy I can give so here goes......
Say you have a YARD object. It contains 5 German Shepards objects - the only kind it will ever contain.
However, the YARD object will leash the 1st shepard right near its gate. The other 4 will be leashed further back. For these 4, YARD will wrap and provide to its users: YardDogBark() and YardDogHowl().
The first dog, however, will be wrapped to include YardDogBite(), since it is right near the gate.
I know in terms of inheritance, a derived class is never supposed to "diminish" the ability of the base class, only augment or supplement it.
But YARD contains the dogs. So is it a common / acceptable thing for a wrapping class to wrap MORE of 1 multiply contained object than it does of the others?, thereby making one of the multiple objects somehow different than the others?
Not sure if this breaks any hiding rules like it would for inheriting.
thanks, joe