You must Sign In to post a response.
  • Category: .NET

    Difference between abstractclass and inheritacne in c#

    Dear All,



    Difference between abstractclass and inheritacne in c# with examples

    Difference between abstractclass and interface in c# with example


    Please help me
  • #746887
    Hi,

    Please refer below articles for sample code detailed explanation for the difference between abstract class and inheritance in c# with examples : vkinfotek.com/oops/abstract-class-inheritance-csharp.html

    Let me know if you require any more details.


    Regards,
    Asheej T K

  • #746893
    Hi,

    Abstract Class:

    Abstract class is same like class using Abstract keyword we can override one class information into another class. We can't able to inherit multiple class information at a time.

    Inheritance Class:

    Inheritance is the mechanism to inherit multiple class information.

    This is the basic difference between 2, if you want to know more about then search in google for the same.

    Hope this will help you to resolve your doubts..

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #746917
    Below are some of the differences between abstract classes, Inheritance and interface:

    1.Abstract class can contain methods with implementation and without implementation whereas interface must only contain methods without implementation.

    2.Even if only one member of the class in abstract the class must be marked as abstract. whereas in case of interface, by default all the members are public and abstract.

    3.A class can be inherited from only one other class whereas it can implement more than one interface.

    4.A method in base class may or may not be overriden in child class whereas in case of interface, the child class must implement each method of the interface.

    Miss. Jain
    Microsoft Certified Technology Specialist in .Net

  • #746940
    Abstract Class:

    Abstract Class Can contain Abstract Methods and Non- Abstract Methods.

    When a Non-Abstract Class is Inherited from an Abstract Class, the Non-Abstract Class should provide all the implementations for the inherited Abstract Method.

    Interface:

    Interface is nothing but Pure Abstract Class ie Interface can contain only the function declaration.

    All the members of the interface are Public by Default and you cannot provide any access modifiers.

    When a class is inherited from the interface, the inherited class should provide actual implementations for the inherited members.


  • Sign In to post your comments