Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 248059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:18:40+00:00 2026-05-11T21:18:40+00:00

Why do both the abstract class and interface exist in C# if we can

  • 0

Why do both the abstract class and interface exist in C# if we can achieve the interface feature by making all the members in the class as abstract.

Is it because:

  1. Interface exists to have multiple inheritance
  2. It makes sense to have interface because object’s CAN-DO feature should be placed in an interface rather base abstract class.

Please clarify

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T21:18:40+00:00Added an answer on May 11, 2026 at 9:18 pm

    Well, an abstract class can specify some implemetation, but usually not all of it. (Having said which, it’s perfectly possible to provide an abstract class with no abstract members, but plenty of virtual ones which with “no-op” implementations). An interface provides no implementation, merely a contract.

    You could certainly argue that if multiple inheritance of classes were permitted, interfaces would be largely pointless.

    Personally I don’t get hung up on the whole “is-a” vs “can-do” distinction for inheritance. It never gives me as good an intuition about what to do as just playing around with different ideas and seeing which ones feel the most flexible. (Then again, I’m very much a “favour composition over inheritance” guy…)

    EDIT: Just as the most convenient way of rebutting lbushkin’s third point in his comment… you can override an abstract method with a non-virtual one (in terms of not being able to override it further) by sealing it:

    public abstract class AbstractBase
    {
        public abstract void Foo();
    }
    
    public class Derived : AbstractBase
    {
        public sealed override void Foo() {}
    }
    

    Classes deriving from Derived cannot override Foo any further.

    I’m not in any way suggesting I want multiple inheritance of implementation – but if we did have it (along with its complexity) then an abstract class which just contained abstract methods would accomplish almost everything that an interface does. (There’s the matter of explicit interface implementation, but that’s all I can think of at the moment.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an abstract base class called Shape from which both Circle and Rectangle
I understand that neither a abstract class nor an interface can contain a method
Can an abstract class be used as the contract object between a 'Host' and
Possible Duplicate: Interface vs Abstract Class (general OO) Hi guys, I decided to dig
Is there a reason to use a 100% abstract class and not an interface
Both are mathematical values, however the float does have more precision. Is that the
A typical problem in OO programming is the diamond problem. I have parent class
I understand that one can raise an event in the class that the implementation
I have two Java class hierarchies that share a common ancestor and implement a
So basically i have a domain object and a generic repository that can do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.