Subscribe to Subscribers
Talk to Webmaster Tony John

Online Members

baskar
More...

Forums » .NET » ASP.NET »

Diff b/w interface abstract class ?


Posted Date: 11 Sep 2009      Posted By:: Vinod Krishna     Member Level: Gold    Member Rank: 890     Points: 1   Responses: 3



can we create object 4 interface or not ?



Responses

#423272    Author: Sudeep Syamnath      Member Level: Gold      Member Rank: 933     Date: 11/Sep/2009   Rating: 2 out of 52 out of 5     Points: 2

Hello Vinod,

We cannot instantiate an interface or an abstract class.

Best Regards,
Sudeep Syamnath

PS: Please rate the answer



 
#423323    Author: Elampooranan      Member Level: Silver      Member Rank: 1145     Date: 11/Sep/2009   Rating: 2 out of 52 out of 5     Points: 2

Unable to create object for interface .Instead you can inherit it from another interface


 
#423572    Author: Yuvaraj      Member Level: Gold      Member Rank: 382     Date: 11/Sep/2009   Rating: 2 out of 52 out of 5     Points: 2

Diff Between Abstract class & Interface

Interfaces are essentially having all method prototypes no definition but Abstract class can contain method definations also.

In short Interface is a abstract class having all methods abstract.

Both abstract classes and interfaces are used when there is a difference in behaviour among the sub-types extending the abstract class or implementing the interface.

When the sub-types behaviour is totally different then you use an interface, when the sub-types behaviour is partially common and different with respect to the supertype an abstract class is used. In an abstract class the partially common behaviour is given a concrete implementation. Since there is no common behaviour between an interface and a sub-type an interface does not have an implementation for any of its behaviour.

If you create a abstract class writing the abstract keyword in the declaration part then You only can inherit the class. You can not create an instance of this abstract class but can inherit the class and with creating the instance of the derived class you can access the method of the abstract class.

If you use a virtual keyword in a method then you can override this method in the subclass if you wish..

If you create a abstract method then you must override this method in the subclass other wise it shows error in the program.

Yuvaraj.K






 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : Storing and retreiving image in sql database.
Previous : Asp.net with c# ,updating in gridview
Return to Discussion Forum
Post New Message
Category:

Related Messages
Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
2005 - 2012 All Rights Reserved.
.NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
Articles, tutorials and all other content offered here is for educational purpose only.
We are not associated with Microsoft or its partners.