Results 1 to 3 of 3

Thread: What is Friend?

  1. #1
    zchoyt
    Guest

    What is Friend?

    Can someone please explain what the Friend keyword does.
    Thanks

  2. #2
    PowerPoster Lethal's Avatar
    Join Date
    Oct 2000
    Location
    Ohio
    Posts
    2,496
    Okay. I could be completely wrong, but I'll give ya the VB6 explanation of what the Friend property is, since I have just now dived into the world of .Net. Friend basically exposes functionality to other objects (classes) within a component, yet shields it's own existence to the outside world. For example, me, a client application that references a particular component. There might be a friend property or function within the component called 'LogEvent', which logs a certain event whenever something happens within the component. All of the guys within the component know the property (or function) exists, but me, the client, have no idea that 'LogEvent' even exists. I hope my example makes clears things up for you.

  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    That sounds correct to me. A summary


    Private - Available only to the scope of which it is declared

    Friend - Available Application wide

    Public - Available to any outside application.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

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