Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Fundamentals

Fundamentals

Scheduled Pinned Locked Moved .NET (Core and Framework)
question
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    HakunaMatada
    wrote on last edited by
    #1

    What is the difference between internal and private access modifiers? If I declare a method as private and another method as internal, what's the difference? If I declare a class as private, what happens? Who will be able to use that class? Hope I find the answers soon, coz this thing is making my head spin round and round? :doh: :wtf: --- With best regards, A Manchester United Fan The Genius of a true fool is that he can mess up a foolproof plan!

    M C 2 Replies Last reply
    0
    • H HakunaMatada

      What is the difference between internal and private access modifiers? If I declare a method as private and another method as internal, what's the difference? If I declare a class as private, what happens? Who will be able to use that class? Hope I find the answers soon, coz this thing is making my head spin round and round? :doh: :wtf: --- With best regards, A Manchester United Fan The Genius of a true fool is that he can mess up a foolproof plan!

      M Offline
      M Offline
      MF
      wrote on last edited by
      #2

      If you search "internal access modifier" in VS, you can find : <--- internal : Access is limited to the current assembly. private : Access is limited to the containing type. -->

      1 Reply Last reply
      0
      • H HakunaMatada

        What is the difference between internal and private access modifiers? If I declare a method as private and another method as internal, what's the difference? If I declare a class as private, what happens? Who will be able to use that class? Hope I find the answers soon, coz this thing is making my head spin round and round? :doh: :wtf: --- With best regards, A Manchester United Fan The Genius of a true fool is that he can mess up a foolproof plan!

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        Save My Soul - (SMS) wrote:

        If I declare a class as private, what happens? Who will be able to use that class?

        You can embed one class inside another. The class can be declared as private and only the containing class can use it.

        public class ContainingClass
        {
        private class EmbeddedClass
        {
        // Stuff
        }

        public void SomeMethod()
        {
            // This will work.
            EmbeddedClass o = new EmbeddedClass();
        }
        

        }

        My: Blog | Photos "Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius

        P 1 Reply Last reply
        0
        • C Colin Angus Mackay

          Save My Soul - (SMS) wrote:

          If I declare a class as private, what happens? Who will be able to use that class?

          You can embed one class inside another. The class can be declared as private and only the containing class can use it.

          public class ContainingClass
          {
          private class EmbeddedClass
          {
          // Stuff
          }

          public void SomeMethod()
          {
              // This will work.
              EmbeddedClass o = new EmbeddedClass();
          }
          

          }

          My: Blog | Photos "Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius

          P Offline
          P Offline
          ProffK
          wrote on last edited by
          #4

          I think mentioning this embedding is crucial to somebody understanding it. The DJ's took pills to stay awake and play for seven days. - Jim Morrison, Black Polished Chrome.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups