Difference between abstract class and interface

Answer Posted / sreekanth madamanchi

1. Abstract classes can have implementations for some of
its members (Methods), but the interface can't have
implementation for any of its members.

2. Only an interface can extend another interface, but any
Class can extend an abstract class..
3. Class can inherit only one abstract class, but class can
implement more than one interface
4. An abstract class can contain constructors, but
interface can’t contain any constructors

5. An abstract class can’t support multiple inheritances,
but an interface can support multiple inheritances.
EX:- class A extends AbstractClass
Class A implements interface1, interface2

6. We can use various access modifiers to variables. such
as abstract, protected, internal, public in Abstract Class,
but all of the variables in an interface are implicitly
(Default) static and final.

7. An abstract class can contain abstract and non-abstract
methods, but interface contains only abstract methods. If
we declare the method without having abstract, by default
it takes that method as abstract method

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

.Net Frame work arch?

1789


What is different about namespace declaration when comparing that to package declaration in java?

726


Different types of authentication modes in .net framework ?

707


5. Wcf- Session Managment

1725


What's new in the .net 2.0 class library?

710


How does an appdomain get created?

724


What is .net transaction?

669


How can implement drag and drop using atlas?

742


What are end points, contract, address and bindings?

701


Explain a .net mobile example with details? : Microsoft dot net mobile

637


What is WPF and WCF?

757


What is cache coherency and how is it eliminated? : Dot net architecture

691


What is .net mobile lists. : Microsoft dot net mobile

657


How to improve the cache performance? : Dot net architecture

697


define cache memory? : Dot net architecture

713