Points
to ponder:
With protected field access and overloading Inheritance is suitable
to extend an server from an existing server. In containment the
contained object would not allow access to the private data .
So inheritance is more efficient.
If
this is not the case then server extention will not suffer. It
can be done through inheritance or through containment . But the
client can get affected . In inheritance client can consider both
the original and derived server as of same type. In containment
the new server is not of the type of original server. Thus , the
client's reusablility is affected.
The
extended server "containing" the original server's reference can
also work with the whole family of the original server. Whereas
if extention is through inheritance this is not possible.
By Prof. Rajesh Patkar
back