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. C#
  4. internal and internal protected

internal and internal protected

Scheduled Pinned Locked Moved C#
6 Posts 3 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.
  • S Offline
    S Offline
    Sonia Gupta
    wrote on last edited by
    #1

    Internal-Access is limited to the current assembly. Internal Protected-Access is limited to the current assembly or types derived from the containing class. after then i implemented it , for that i created window application project and a class library project. in class library project namespace i did the following code namespace ClassLibrary1 { public class Class1 { protected int aniket = 10; protected internal int tushar = 20; internal int pavan = 30; } } and in the window application project , after adding the reference of class library project , in the class file , i did the following code. namespace validation1 { class Class2: Class1 { void method() { //variable aniket and tushar are accessible in thederived class due to reason that they are protected inernal and protected respectively. //while the member named pawan is not assessible, because it's datatype is intenal. Is this all the difference between internal and internal protected. I mean , i wanted to ask that the findings i did for these two access modifiers are correct , or there is somethig else , that is needed to be understood the difference between them. } } }

    Sonia Gupta Soniagupta1@yahoo.co.in Yahoo messengerId-soniagupta1 Love is Friendship and Friendship is Love....

    N V 2 Replies Last reply
    0
    • S Sonia Gupta

      Internal-Access is limited to the current assembly. Internal Protected-Access is limited to the current assembly or types derived from the containing class. after then i implemented it , for that i created window application project and a class library project. in class library project namespace i did the following code namespace ClassLibrary1 { public class Class1 { protected int aniket = 10; protected internal int tushar = 20; internal int pavan = 30; } } and in the window application project , after adding the reference of class library project , in the class file , i did the following code. namespace validation1 { class Class2: Class1 { void method() { //variable aniket and tushar are accessible in thederived class due to reason that they are protected inernal and protected respectively. //while the member named pawan is not assessible, because it's datatype is intenal. Is this all the difference between internal and internal protected. I mean , i wanted to ask that the findings i did for these two access modifiers are correct , or there is somethig else , that is needed to be understood the difference between them. } } }

      Sonia Gupta Soniagupta1@yahoo.co.in Yahoo messengerId-soniagupta1 Love is Friendship and Friendship is Love....

      N Offline
      N Offline
      NaNg15241
      wrote on last edited by
      #2

      You got something wrong. Public = Accessible from everywhere Protected = Accessible from class or derived classes. Private = Accessible only from the same class (if you don't specify anything, by default it will be Private) internal = Access is only for the same assembly. internal means that if I\anyone-else download your class library file (dll) and try to use it, I won't be able to use the stuff that signed with "internal". So what that you basically did was playing with the "Private" modifier. Hope you get what I wrote (I can be not-understandable in the morning). NaNg.

      S 1 Reply Last reply
      0
      • S Sonia Gupta

        Internal-Access is limited to the current assembly. Internal Protected-Access is limited to the current assembly or types derived from the containing class. after then i implemented it , for that i created window application project and a class library project. in class library project namespace i did the following code namespace ClassLibrary1 { public class Class1 { protected int aniket = 10; protected internal int tushar = 20; internal int pavan = 30; } } and in the window application project , after adding the reference of class library project , in the class file , i did the following code. namespace validation1 { class Class2: Class1 { void method() { //variable aniket and tushar are accessible in thederived class due to reason that they are protected inernal and protected respectively. //while the member named pawan is not assessible, because it's datatype is intenal. Is this all the difference between internal and internal protected. I mean , i wanted to ask that the findings i did for these two access modifiers are correct , or there is somethig else , that is needed to be understood the difference between them. } } }

        Sonia Gupta Soniagupta1@yahoo.co.in Yahoo messengerId-soniagupta1 Love is Friendship and Friendship is Love....

        V Offline
        V Offline
        Vikram A Punathambekar
        wrote on last edited by
        #3

        Sonia Gupta wrote:

        Is this all the difference between internal and internal protected.

        Yes. Protected - visible to all subclasses Internal - visible everywhere within the assembly Protected internal - visible to all subclasses *and* everywhere within the assembly.

        Cheers, Vıkram.


        Be yourself, no matter what they say. - Sting, Englishman in New York.

        S 1 Reply Last reply
        0
        • N NaNg15241

          You got something wrong. Public = Accessible from everywhere Protected = Accessible from class or derived classes. Private = Accessible only from the same class (if you don't specify anything, by default it will be Private) internal = Access is only for the same assembly. internal means that if I\anyone-else download your class library file (dll) and try to use it, I won't be able to use the stuff that signed with "internal". So what that you basically did was playing with the "Private" modifier. Hope you get what I wrote (I can be not-understandable in the morning). NaNg.

          S Offline
          S Offline
          Sonia Gupta
          wrote on last edited by
          #4

          code is right or wrong?

          Sonia Gupta Soniagupta1@yahoo.co.in Yahoo messengerId-soniagupta1 Love is Friendship and Friendship is Love....

          N 1 Reply Last reply
          0
          • V Vikram A Punathambekar

            Sonia Gupta wrote:

            Is this all the difference between internal and internal protected.

            Yes. Protected - visible to all subclasses Internal - visible everywhere within the assembly Protected internal - visible to all subclasses *and* everywhere within the assembly.

            Cheers, Vıkram.


            Be yourself, no matter what they say. - Sting, Englishman in New York.

            S Offline
            S Offline
            Sonia Gupta
            wrote on last edited by
            #5

            http://www.codeproject.com/script/comments/forums.asp?msg=2201926&forumid=1649#xx2201926xx[^]

            Sonia Gupta Soniagupta1@yahoo.co.in Yahoo messengerId-soniagupta1 Love is Friendship and Friendship is Love....

            1 Reply Last reply
            0
            • S Sonia Gupta

              code is right or wrong?

              Sonia Gupta Soniagupta1@yahoo.co.in Yahoo messengerId-soniagupta1 Love is Friendship and Friendship is Love....

              N Offline
              N Offline
              NaNg15241
              wrote on last edited by
              #6

              No, the definitions of internal and internal protected are wrong. As I explained. In the code you can totally erase the "internal", because you're only playing with private\public modifiers.

              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