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 936077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T21:15:23+00:00 2026-05-15T21:15:23+00:00

I have a interface as follows public interface IX { void MethodA(); void MethodB();

  • 0

I have a interface as follows

 public interface IX
    {
        void MethodA();
        void MethodB();
    }

I have two method contracts in the interface MethodA and MethodB. I will define set of classes that will implement the above interface. Out of these two methods MethodA is common for all the types that will implement the interface. I can define a abstract class as follows

public abstract class XBase:IX
    {
        public void MethodA()
        { 
            // Common behaviour implementation
        }

        public abstract void MethodB();
    }

And inherit this class to all the types that need to implement the above interface. It works.

But here in the abstract class i add ‘public abstract void MethodB();’. It looks like repetition of the MethodB contract.

Why C# does not permit partial interface implementation if the class is abstract?. The above interface has only two methods. suppose one interface has 10 methods and 5 are common functionality and 5 are not, we are forced to add the 5 methods that are not common in the abstract class?

  • 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-15T21:15:24+00:00Added an answer on May 15, 2026 at 9:15 pm

    Because the C# language specification says so. Chapter 13.4.7:

    Like a non-abstract class, an abstract class must provide implementations of all members of the interfaces that are listed in the base class list of the class.

    Why the C# designers chose to specify the language like this is probably best answered by Eric Lippert. I’d personally guess at reducing the odds that unintended method hiding occurs, producing error messages that are very hard to interpret. I would personally have been more comfortable requiring the use of the overrides keyword for the interface method implementation. But they chose not to.

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

Sidebar

Related Questions

I have a service set up as follows: public interface IMyService { void AddCountry(string
I have an interface Damageable as follows public interface Damageable { public void handleCollision(float
I have code that looks like follows: public interface BaseDAO{ // marker interface }
So I have an Interface as follows public interface IMembershipProvider { bool GetUserGuidFromSSOToken(string ssoToken,
I have a interface as follows: [InheritedExport(typeof(ITransform))] public interface ITransform {...} Now, I have
I have a interface as follows: namespace Contract { [InheritedExport(typeof(ITransform))] public interface ITransform {
I have a method defined in IDL as follows : interface IMyFunc : IDispatch
I have an aidl file defined as follows: package com.erbedo.callalert; interface RemoteCallAlert { void
I have interface Foo public interface Foo { public void test(); } Class FooChild
Suppose you have a generic interface and an implementation: public interface MyInterface<T> { void

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.