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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:11:22+00:00 2026-06-08T17:11:22+00:00

Possible Duplicate: What is the difference between Public, Private, Protected, and Nothing? I have

  • 0

Possible Duplicate:
What is the difference between Public, Private, Protected, and Nothing?

I have a question :
What is the difference between these method types ?

Static , Public , Internal , Protected , const , void

Sorry my question may seem awkward to professionals but i really want to understand the difference , and by the way i searched and read articles about them but they are all big and not well described , i just need a nice example for each so i could make decision each time i make a function , because i always start with private void ……..

  • 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-08T17:11:23+00:00Added an answer on June 8, 2026 at 5:11 pm

    Your basic method has the following:

    [access modifier?] [static?] [return type or void] [name] ([parameters?])
    

    There’s a few extra bits and pieces but that’s your start.

    Access Modifiers

    Some of those are access modifiers which control which classes have access (can call) whatever you’ve put the modifier on.

    // Anyone can call me
    public int SomeMethod() { return 1; } 
    
    // Only classes in the same assembly (project) can call me
    internal int SomeMethod() { return 1; } 
    
    // I can only be called from within the same class
    private int SomeMethod() { return 1; }
    
    // I can only be called from within the same class, or child classes
    protected int SomeMethod() { return 1; }
    

    Static

    Static means that the method/variable is shared by all instances of the class. It can be combined with an access modifier from above.

    public class Test
    {
      static int a = 0;
      public int SomeMethod() { a = a + 1; return a; }
    }
    
    Test t1 = new Test();
    t1.SomeMethod(); // a is now 1
    Test t2 = new Test();
    t2.SomeMethod(); // a is now 2
    
    // If 'a' wasn't static, each Test instance would have its own 'a'
    

    Void

    void just means that you have a method that doesn’t return anything:

    public void SomeMethod() 
    { 
      /* I don't need to return anything */ 
    }
    

    const

    const means that the variable cannot be modified:

    const int LIFE = 42;
    // You can't go LIFE = 43 now
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Difference between private, public and protected inheritance in C++ One of the
Possible Duplicate: What is the difference between 'protected' and 'protected internal'? What is the
Possible Duplicate: Difference between Color.red and Color.RED I have seen that the Java class
Possible Duplicate: difference between string object and string literal Let's say I have two
Possible Duplicate: Differences between Private Fields and Private Properties Let's say I have a
Possible Duplicate: Difference between Property and Field in C# public class Test { public
Possible Duplicate: difference between destructor and garbage collector Recently i asked this question ,
Possible Duplicate: What are access specifiers? Should I inherit with private, protected or public?
Possible Duplicate: protected/public Inner Classes I am sure the question has been asked already,
Possible Duplicate: Difference between static class and singleton pattern? we use static class for

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.