Results 1 to 4 of 4

Thread: Abstract class and Interface in .net

  1. #1
    Join Date
    Apr 2009
    Posts
    55

    Abstract class and Interface in .net

    Hello world,

    Can anyone suggest me what is Abstract classes and Interface in .Net and how it is to be implemented, and if possible please provide me the difference between them, probably the difference between both of them comes when their definition comes but if still there some important points to be noted down please let me know.

    Thanks in Advance

  2. #2
    Join Date
    Mar 2008
    Posts
    258

    Re: Abstract class and Interface in .net

    As per i found on the internet as well as in the book, An abstract class is a special kind of class which cannot be instantiated. It only allows other classes to inherit from the main class but cannot be instantiated.

    Whereas,An interface is not a class. It is an entity that is defined by the word Interface. An interface has no implementation; it only has the signature,or else we could say that it is just the definition of the methods without the body.

    Here i will provide you the main difference between them is that a class can implement more than one interface in the program but can only inherit from one abstract class.

  3. #3
    Join Date
    Apr 2008
    Posts
    193

    Re: Abstract class and Interface in .net

    Difference between Abstract class and interface-

    The Abstract class allows concrete methods (methods that have implementation) but interface does not.

    An Abstract class can inherit from only one class, but can implement any number of interfaces.

    Interface doesn’t allow variables/constants to be declared but abstract class allows for declaration of variables and constants.

  4. #4
    Join Date
    Dec 2008
    Posts
    202

    Re: Abstract class and Interface in .net

    Following are some key points related to these two terms that need to remember:
    Interface
    1. We can achieve multiple inheritance through interface
    2. All methods are abstract and there is no implementation.
    3. Interfaces are essentially having all method prototypes no definition
    4. No access modifiers are allowed.


    Abstract class
    1. We can achieve only single inheritance and multi-level inheritance
    2. Some methods can be concrete.
    3. Contain method definitions also.
    4. They have access modifiers
    5. It can not be instantiated

Similar Threads

  1. Static method in Abstract class
    By Anthony12 in forum Software Development
    Replies: 6
    Last Post: 12-08-2010, 10:22 AM
  2. Problem with abstract class and interface
    By Vodka in forum Software Development
    Replies: 5
    Last Post: 08-03-2010, 12:20 PM
  3. Difference among concrete class and abstract class
    By Roxy_jacob in forum Software Development
    Replies: 4
    Last Post: 07-12-2009, 01:22 PM
  4. Abstract class in Java
    By SoftWore in forum Software Development
    Replies: 3
    Last Post: 07-11-2009, 01:58 PM
  5. Replies: 4
    Last Post: 02-03-2009, 08:46 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,502,371.72004 seconds with 17 queries