Question :What are some alternatives to inheritance? (CoreJava)
Answer :Delegation is an alternative to inheritance. Delegation means that you
include an instance of another class as an instance variable, and forward
messages to the instance. It is often safer than inheritance because it
forces you to think about each message you forward, because the instance
is of a known class, rather than a new class, and because it doesn't force
you to accept all the methods of the super class: you can provide only the
methods that really make sense. On the other hand, it makes you write
more code, and it is harder to re-use (because it is not a subclass).
www.interviewhelper.org is a hope for all the Job seekers. Users can find unlimited here. These range from technical to HR, from functional to behavioral. www.interviewhelper.org contains in the fields like Ajax,VB,Networking,Sharepoint,JEE,Perl,Javascript,Bioinformatics,Classic ASP,Unix,Linux,Accounting,Oracle DBA,Microprocessor,Bluetooth,jms,jme,.net framework,ABAP,ASP,ASP.net,Basic .net Framework,Interview Questions,C language,C++,database,Oracle,Java,PHP,LAMP,SAP etc.
Tuesday, March 10, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment