Results 1 to 7 of 7

Thread: *resolved* dumb dumb dumb question - protected

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Smile *resolved* dumb dumb dumb question - protected

    I know this has been asked 1010100100202039028 times, but I DONT GET IT!!!!!

    What's the difference between these two:

    VB Code:
    1. Public Class A
    2.     [COLOR=RED][b]Protected[/b][/color] Class B
    3.  
    4.     End Class
    5. End Class
    and
    VB Code:
    1. Public Class A
    2.     [COLOR=RED][b]Private[/b][/color] Class B
    3.  
    4.     End Class
    5. End Class



    I dont know what Friend, Protected, or Protected Friend means MSDN doesnt help neither, maybe I'm too dumb or whatever, but someone plz explain this
    Last edited by MrPolite; Oct 19th, 2002 at 12:40 AM.
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Friend is Public to anything in the same project otherwise it is treated as Private. Protected is somewhat like that only instead of Public to the Project it is Public to the class and any class derived from that class.

  3. #3
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    From a book:
    Public - Can be accessed from anywhere.

    Private - Can be accessed only by members within the type that defines it.

    Friend - Can be accessed form all types within the assembly, but not from outside the assembly.

    Protected - Can be accessed only by members within the type that defines it or types that inherit from that type.

    Protected Friend - Can be accessed from all types within the assembly or from types inheriting from the owning type. This is the union of Protected and Friend access.

  4. #4

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    ok, kinda get it
    just what does it mean when it says "within the assembly"? what's an assembly?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    An assembly is an exe or dll whatever the project basically is.

  6. #6

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by Edneeis
    An assembly is an exe or dll whatever the project basically is.
    hmm, so if you have two projects in one solution, and you have a Friend variable, it an be only accessed in one of the project?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  7. #7
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Yes just like groups in VB6, in fact Friend isn't new with .NET we had it in VB6, too.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width