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

  • Home
  • SEARCH
  • 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 6849257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:58:06+00:00 2026-05-27T00:58:06+00:00

The following F# code declares base and descendant classes. The base class has a

  • 0

The following F# code declares base and descendant classes. The base class has a virtual method ‘Test’ with a default implementaion. The descendant class overrides the base class method and also adds a new overloaded ‘Test’ method. This code compiles fine and presents no issues when accessing either of the descendant ‘Test’ methods.

F# Code:

module OverrideTest
  [<AbstractClass>]
  type Base() =
    abstract member Test : int -> int
    default this.Test x = x + 1

  type Descendant() =
    inherit Base()
    override this.Test x    = x - 1
    member this.Test (x, y) = x - y

However, attempting to invoke the descendant’s override of ‘Test’ from C# results in a compilation error:

var result = td.Test(3); <- No overload for method ‘Test’ takes 1 arguments

The full C# Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Client
{
  class Program
  {
    static void Main(string[] args)
    {
      var td = new OverrideTest.Descendant();
      var result = td.Test(3);
      Console.WriteLine(result);
      Console.ReadKey();
    }
  }
}

The strange thing is that VisualStudio’s intellisense sees the two overloaded functions, and provides correct signatures for both. It gives no warnings or errors before the build fails, and only highlights the line afterwards.

I have re-implemented this scenario fully in C# and did not run into the same problem.

Anyone have any ideas what’s going on here?

  • 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-27T00:58:07+00:00Added an answer on May 27, 2026 at 12:58 am

    No doubt you’re aware that if you omit the Test(x,y) member from the Descendant type — or simply rename it Test2(x,y) — then the C# code will compile and run as expected.

    Looking at the IL generated for your original Descendant type offers a clue:

    .method public hidebysig virtual
        instance int32 Test (
            int32 x
        ) cil managed ...
    
    .method public 
        instance int32 Test (
            int32 x,
            int32 y
        ) cil managed ...
    

    Notice that there’s no hidebysig attribute on the Test(x,y) method.

    The ECMA CLI specification has the following to say about hidebysig. (Section 15.4.2.2, emphasis in bold is mine.)

    hidebysig is supplied for the use of tools and is ignored by
    the VES. It specifies that the declared method hides all methods of
    the base class types that have a matching method signature; when
    omitted, the method should hide all methods of the same name,
    regardless of the signature
    .

    So, the F# compiler omits the hidebysig attribute, meaning that the Test(x,y) method hides all other methods named Test. Although hidebysig is only “for the use of tools”, it appears that the C# compiler is one of those tools that uses it!

    This looks to me like it could be a bug in the F# compiler, but since I’ve never looked at the F# spec it’s always possible that this is allowed/specified behaviour.

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

Sidebar

Related Questions

I have the following code where class A declares class B as friend. Should
Please look at the following code listing: #include <iostream> using namespace std; class Base
In the following code snippet, the Color enum is declared within the Car class
Given the following code: public interface IExample { ... } public abstract class BaseExample:
I have the following code: public partial class Form1 : Form { public BindingList<Class>
The following code has been created from a different post, but I now have
The following code: struct interface_base { virtual void foo() = 0; }; struct interface
In short, the following code calls an existing selector in the super class, and
I have a base Class akin to the code below. I'm attempting to overload
I have the following base class: abstract class Base { public abstract object Var

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.