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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:17:03+00:00 2026-06-18T17:17:03+00:00

I was told that static methods are implicitly final and therefore can’t be overridden.

  • 0

I was told that static methods are implicitly final and therefore can’t be overridden. Is that true?

  1. Can someone give a better example of overriding a static method?

  2. If static methods are just class methods, what is the real use of having them?

  • 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-18T17:17:05+00:00Added an answer on June 18, 2026 at 5:17 pm

    (1) Static methods cannot be overridden, they can however be hidden using the ‘new’ keyword. Mostly overriding methods means you reference a base type and want to call a derived method. Since static’s are part of the type and aren’t subject to vtable lookups that doesn’t make sense.

    E.g. statics cannot do:

    public class Foo { 
        public virtual void Bar() { ... }
    }
    public class Bar : Foo {
        public override void Bar() { ... }
    }
    
    // use:
    Foo foo = new Bar(); // make an instance
    foo.Bar(); // calls Bar::Bar
    

    Because statics don’t work on instances, you always specify Foo.Bar or Bar.Bar explicitly. So overriding has no meaning here (try expressing it in code…).

    (2) There are different usages for static methods. For example, it’s being used in the Singleton pattern to get a single instance of a type. Another example is ‘static void Main’, which is the main access point in your program.

    Basically you use them whenever you don’t want or cannot create an object instance before using it. For example, when the static method creates the object.

    [update]

    A simple hiding example:

    public class StaticTest
    {
        public static void Foo() { Console.WriteLine("Foo 1"); }
        public static void Bar() { Console.WriteLine("Bar 1"); }
    }
    
    public class StaticTest2 : StaticTest
    {
        public new static void Foo() { Console.WriteLine("Foo 2"); }
        public static void Some() { Foo(); Bar(); } // Will print Foo 2, Bar 1
    }
    
    public class TestStatic
    {
        static void Main(string[] args)
        {
            StaticTest2.Foo();
            StaticTest2.Some();
            StaticTest.Foo();
            Console.ReadLine();
        }
    }
    

    Note that if you make the classes static, you cannot do this. Static classes have to derive from object.

    The main difference between this and inheritance is that the compiler can determine at compile-time which method to call when using static. If you have instances of objects, you need to do this at runtime (which is called a vtable lookup).

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

Sidebar

Related Questions

Recently I have been told that static class/methods are evil. Take for example my
I was told more than once that Delphi handles dynamic classes better than static.Thereby
I was told that static methods in java didn't have Inheritance but when I
Someone somewhere told me that Java constructors are synchronized so that it can't be
I was told that a function defined as static in one .c file is
I was told that for some reason, you can't update a database schema when
I was told that in Java, unchecked exceptions can be caught in a try
I was told that using break and continue labels in an OOP language is
I was told that Respond.Redirect is an expensive process because it raises a ThreadAbortException.
I was told that the optimal way to program in C++ is to use

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.