difference between abstract and interface
abstract and interface
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vilas GitePosted Aug 19, 2011, 2:20 AM
Hi Jon,
Read Our recommended articles
And go through with by jitu, provide very good link.
If this reply helps your post…then check "This is correct answer"
Jiteendra SampathiraoPosted Aug 19, 2011, 1:43 AM
better to ask this type of questions in interview corner section ..
Click Here
Satyapriya NayakPosted Aug 19, 2011, 1:22 AM
Abstract class
A class that cannot be instantiated. An abstract class is a class that must be inherited and have the methods overridden. An abstract class is essentially a blueprint for a class without any implementation.
An abstract class is a special kind of class that cannot be instantiated. It normally contains one or more abstract methods or abstract properties. It provides body to a class.
Interface
An interface has no implementation; it only has the signature or in other words, just the definition of the methods without the body.
It's an abstract class with public abstract methods all of which must be implemented in the inherited classes.
In which Scenario you will go for Interface or Abstract Class?
Interfaces, like classes, define a set of properties, methods, and events. But unlike classes, interfaces do not provide implementation. They are implemented by classes, and defined as separate entities from classes. Even though class inheritance allows your classes to inherit implementation from a base class, it also forces you to make most of your design decisions when the class is first published.
Abstract classes are useful when creating components because they allow you specify an invariant level of functionality in some methods, but leave the implementation of other methods until a specific implementation of that class is needed. They also version well, because if additional functionality is needed in derived classes, it can be added to the base class without breaking code.
Difference Abstract class vs Interface
In the interface all methods must be abstract, in the abstract class some methods can be concrete. In the interface no accessibility modifiers are allowed, which is ok in abstract classes.Thanks
If this post helps you mark it as answer
Jaganathan BantheswaranPosted Aug 19, 2011, 1:11 AM
Read,
Abstract Class vs Interface
Abstract Class, Interface and relation to Method Overriding and Method Hiding in C#
What is an Interface?
Abstract Classes And Methods
Satyapriya NayakPosted Aug 19, 2011, 1:08 AM
Please look at our recommended articles section.
Thanks