Interface and abstract class, comparison

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

We know c# don't support multiple inheritance, and that can be suplied using Interfaces..

But I have a doubt, what is the diferences between and abstract class without not virtual methods, and an interface?

And where can i find some information about the implementation of both of them, I mean how the compiler work with them.

Thank in advantage....
 
We know c# don't support multiple inheritance, and that can be suplied
using Interfaces...

Actually, I don't know that. Interfaces are not a replacement for MI, no
more than System.Object a replacement for generics.
But I have a doubt, what is the diferences between and abstract class
without not virtual methods, and an interface?.

Interfaces cannot have fields, static members, constants, special members
like constructors or finalizers, or nested type definitions.
Interfaces can't specify access for members.
A structure can implement an interface, but it cannot subclass an abstract
class.
Interfaces can be explicitly implemented, abstract types can't.
Implementing an interface is all-or-nothing, but an abstract class can
implement part of an abstract base class.
And where can i find some information about the implementation of both
of them, I mean how the compiler work with them.

Check the C# spec or a good C# book. The .NET and C# specs are here:
http://www.dotnetexperts.com/ecma/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top