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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:11:45+00:00 2026-05-24T20:11:45+00:00

For the record, I’ve already seen this connect item but I can’t really understand

  • 0

For the record, I’ve already seen this connect item but I can’t really understand what would be the problem in supporting this.

Say I have the following code:

public interface IInterface
{
    void Method();
}

public class Base : IInterface
{
    virtual void IInterface.Method()
    {
        throw new NotImplementedException();
    }
}

what is the problem with the virtual identifier? Having a virtual modifier would make it possible to override indicating there’s a different implementation in the base class. I can make it work now by removing the virtual method and creating the derived class like this:

public class Derived : IInterface
{
    void IInterface.Method()
    {
        throw new NotImplementedException();
    }
}

however this way I’ve really no indication at all that I’m overriding something.

Update:
According to the C# (part: 20.4.1 Explicit interface member implementations) spec there are 2 reasons.

  1. Hiding of certain methods (which I’m using it for).
  2. Having 2 functions with the same signature but different return types
    (usefull for IClonable for example).

It doesn’t say anything however about why you can’t make these methods virtual.

Update2:
Given the answers I think I should rephrase the real question here. If The above 2 reasons are the reason why explicit implementation of interfaces was made possible in the first place. Why would it be a problem if you make a method virtual.

  • 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-24T20:11:48+00:00Added an answer on May 24, 2026 at 8:11 pm

    however this way I’ve really no indication at all that I’m overriding something

    Well, you do, sort of – you have the fact that it’s clearly an explicit interface implementation. That shows it’s providing polymorphic behaviour for that method call which is specified on an interface… why does it matter whether the base class also implemented the interface? What difference will it make to you when you read the code?

    To me, the main benefit of stating override is to make sure I’ve really got the right signature – that it matches the thing I’m trying to override. You’ve already got that benefit with explicit interface implementation, as if you give a non-existent method or the wrong parameters etc, the compiler will already complain.

    I can sort of see your point, but I’ve never found it to be an actual problem.

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

Sidebar

Related Questions

Im trying to record video using AVFoundation I can save images but not video.
TPath record has class constructor TPath.Create which initialize class vars. But, I can't find
I want to record what various sources have to say about a historical figure.
is it possible to record a video straight to Youtube? Say I have a
My Record Constructor looks like this: #include Record.h //both these headers #include <iostream> #include
I know how to record audio in actionscript 3. But is it possible to
I have an inventory record XML file to store the quantity of each item.
How can I read record parameters from the form object (@banner.name)? = simple_form_for @banner
I have a json record like blow [{low:null,high:10,type:2,value:0},{low:10,high:60,type:1,value:10},{low:60,high:null,type:2,value:11}] I would like to create array
I would like to record the video of things happening in an iPhone/iPad screen.

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.