interface & delegate
Reply
![]() |
|
From:
![]() _OneSip_
|
Interface vs. abstract class
Choosing interfaces and abstract classes is not an either/or proposition. If you need to change your design, make it an interface. However, you may have abstract classes that provide some default behavior. Abstract classes are excellent candidates inside of application frameworks.
Abstract classes let you define some behaviors; they force your subclasses to provide others. For example, if you have an application framework, an abstract class may provide default services such as event and message handling. Those services allow your application to plug in to your application framework. However, there is some application-specific functionality that only your application can perform. Such functionality might include startup and shutdown tasks, which are often application-dependent. So instead of trying to define that behavior itself, the abstract base class can declare abstract shutdown and startup methods. The base class knows that it needs those methods, but an abstract class lets your class admit that it doesn't know how to perform those actions; it only knows that it must initiate the actions. When it is time to start up, the abstract class can call the startup method. When the base class calls this method, Java calls the method defined by the child class.
Many developers forget that a class that defines an abstract method can call that method as well. Abstract classes are an excellent way to create planned inheritance hierarchies. They're also a good choice for nonleaf classes in class hierarchies.
from http://www.javaworld.com/javaworld/javaqa/2001-04/03-qa-0420-abstract.html
On Fri, 14 May 2004 00:39:20 -0700, dotNET User Group Hyd <[EMAIL PROTECTED]> wrote: > New Message on dotNET User Group Hyd > > interface & delegate > > Reply > Recommend Message 1 in Discussion > From: imparesh007 > > Hi Lakshmi, > > thanx for the explanation. > > Bye > Pares > > _________________________________________________________________ > Marriage? http://www.bharatmatrimony.com/cgi-bin/bmclicks1.cgi?74 Join > BharatMatrimony.com for free. > > View other groups in this category. > > > Also on MSN: > Start Chatting | Listen to Music | House & Home | Try Online Dating | Daily > Horoscopes > > To stop getting this e-mail, or change how often it arrives, go to your > E-mail Settings. > > Need help? If you've forgotten your password, please go to Passport Member > Services. > For other questions or feedback, go to our Contact Us page. > > If you do not want to receive future e-mail from this MSN group, or if you > received this message by mistake, please click the "Remove" link below. On > the pre-addressed e-mail message that opens, simply click "Send". Your > e-mail address will be deleted from this group's mailing list. > Remove my e-mail address from dotNET User Group Hyd.
-- "In the power to change yourself is the power to change the world around you." - Anwar Sadat
|
|
View other groups in this category.
![]() |
To stop getting this e-mail, or change how often it arrives, go to your E-mail Settings.
Need help? If you've forgotten your password, please go to Passport Member Services.
For other questions or feedback, go to our Contact Us page.
If you do not want to receive future e-mail from this MSN group, or if you received this message by mistake, please click the "Remove" link below. On the pre-addressed e-mail message that opens, simply click "Send". Your e-mail address will be deleted from this group's mailing list.
Remove my e-mail address from dotNET User Group Hyd.
|
|