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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:32:51+00:00 2026-05-11T07:32:51+00:00

All my college years I have been using public , and would like to

  • 0

All my college years I have been using public, and would like to know the difference between public, private, and protected?

Also what does static do as opposed to having nothing?

  • 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. 2026-05-11T07:32:52+00:00Added an answer on May 11, 2026 at 7:32 am

    Access modifiers

    From learn.microsoft.com:

    public

    The type or member can be accessed by any other code in the same assembly or another assembly that references it.

    private

    The type or member can only be accessed by code in the same class or struct.

    protected

    The type or member can only be accessed by code in the same class or struct, or in a derived class.

    private protected (added in C# 7.2)

    The type or member can only be accessed by code in the same class or struct, or in a derived class from the same assembly, but not from another assembly.

    internal

    The type or member can be accessed by any code in the same assembly, but not from another assembly.

    protected internal

    The type or member can be accessed by any code in the same assembly, or by any derived class in another assembly.

    When no access modifier is set, a default access modifier is used. So there is always some form of access modifier even if it’s not set.

    static modifier

    The static modifier on a class means that the class cannot be instantiated, and that all of its members are static. A static member has one version regardless of how many instances of its enclosing type are created.

    A static class is basically the same as a non-static class, but there is one difference: a static class cannot be externally instantiated. In other words, you cannot use the new keyword to create a variable of the class type. Because there is no instance variable, you access the members of a static class by using the class name itself.

    However, there is a such thing as a static constructor. Any class can have one of these, including static classes. They cannot be called directly & cannot have parameters (other than any type parameters on the class itself). A static constructor is called automatically to initialize the class before the first instance is created or any static members are referenced. Looks like this:

    static class Foo() {     static Foo()     {         Bar = "fubar";     }          public static string Bar { get; set; } } 

    Static classes are often used as services, you can use them like so:

    MyStaticClass.ServiceMethod(...); 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All -- I have these two methods in one of my classes: public static
I have been programming in a learn-by-doing fashion for almost 2 years now and
I have been a Half-Life lover for years. I have a BS in CS
I did a module in Java in college but we did it all using
I am fresh out of college and I've been put on a project using
I have been developing websites for a couple of years now and I almost
I am a college student and have been asked to familiarize myself with PCCTS,
I've been doing server-side development for several years, and have not had much (read
I work at a small college that wants to make sites for all of
All, If I run a query like the following: $qry = Select wrong_column from

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.