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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:27:07+00:00 2026-06-08T18:27:07+00:00

Possible Duplicate: Overload resolution and virtual methods If i call this , why object

  • 0

Possible Duplicate:
Overload resolution and virtual methods

If i call this , why object method is being called?

Classes.Class2 c = new Classes.Class2();
c.GetJ(1);

public class Class1
{
   public virtual void GetJ(int j)
   {

   }
}

class Class2:Class1
{
    public override void GetJ(int j)
    {
       int j3 = 8;
    }

     public void GetJ(object j)
     {
        int j1 = 82;
     }
}
  • 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-06-08T18:27:08+00:00Added an answer on June 8, 2026 at 6:27 pm

    See the C# 4.0 Specification ( https://www.microsoft.com/en-us/download/details.aspx?id=7029 )

    7.4 Member lookup

    First, a set of accessible members named N is determined:

    • If T is a type parameter, then the set is the union of the sets of accessible members named N in each of the types specified as a primary constraint or secondary constraint (§10.1.5) for T, along with the set of accessible members named N in object.

    • Otherwise, the set consists of all accessible (§3.5) members named N in T, including inherited members and the accessible members named N in object. If T is a constructed type, the set of members is obtained by substituting type arguments as described in §10.3.2. Members that include an override modifier are excluded from the set.

    I don’t understand that behavior, but this is in the specification, so it is correct, even if a bit disturbing (and I have a C++ background)…

    Edit:

    This is indeed a duplicate question (as correctly discovered by Anders Abel in his comment).

    See the original Overload resolution and virtual methods for an explanation for this behavior.

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

Sidebar

Related Questions

Possible Duplicate: «F(5)» and «int x; F(x)» to call different functions? Can we overload
Possible Duplicate: C++ overload resolution I ran into a problem where after my class
Possible Duplicate: Operator Overloading with C# Extension Methods How can i overload those operators,
Possible Duplicate: Any reason to overload global new and delete? In c++ you can
Possible Duplicate: Can you overload controller methods in ASP.Net MVC? I need to 2
Possible Duplicate: Create an empty object in JavaScript with {} or new Object()? When
Possible Duplicate: Overload ++ operator Say i have a class in which i overloads
Possible Duplicate: Operator[][] overload I've looked on the internet but can't find a definitive
Possible Duplicate: Java operator overload In c++, we can perform the operator overloading. But
Possible Duplicate: Can I overload an == operator on an Interface? I do understand

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.