WHAT IS THE DIFFERENCE BETWEEN STATIC AND INSTANCE METHODS?

Sumit Kesarwani

Total Post:0

Points:0
Posted by  Sumit Kesarwani
C# 
C#
 1484  View(s)
Ratings:
Rate this:
  1. Sumit Kesarwani

    Post:782

    Points:3910
    What is the difference between static and instance methods?

    A method declared with a static modifier is a static method. A static method does not operate on a specific instance and can only access static members.

    A method declared without a static modifier is an instance method. An instance method operates on a specific instance and can access both static and instance members. The instance on which an instance method was invoked can be explicitly accessed as this. It is an error to refer to this in a static method.

      Modified On Mar-27-2018 04:18:49 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!