locked
friend and protected friend modifier RRS feed

  • Question

  • User1192622652 posted

    Hi all

    I want to know about using friend and protected friend modifier.

    Please give me example with these concept.

    Monday, April 7, 2008 5:31 AM

Answers

  • User541108374 posted

    I want  example too.
     

    The best way for you to be able to get a good understanding of this is to create a console application with several classes/methods/properties of which you set the access modifiers. See what comes into Intellisense and which not. Try debugging the application and see how it behaves. This is the best way for you to learn at this moment.

    Grz, Kris. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 7, 2008 9:19 AM

All replies

  • User541108374 posted

    Hi,

    taken from the MSDN documentation:

    The Protected keyword confers protected access on one or more declared programming elements. Protected elements are accessible only from within their own class or from a derived class. Protected access is not a superset of friend access.

    The Protected keyword can be used in conjunction with the Friend keyword in the same declaration. This combination confers both friend and protected access on the declared elements, so they are accessible from the same assembly, from their own class, and from any derived classes.

     

    Grz, Kris. 

     

    Monday, April 7, 2008 5:58 AM
  • User1192622652 posted

     Hi Kris,

    Thanx for your reply.

    But the problem is

    I want  example too.

    If you have some kinds of example about this topics please help me 

    Monday, April 7, 2008 7:34 AM
  • User541108374 posted

    I want  example too.
     

    The best way for you to be able to get a good understanding of this is to create a console application with several classes/methods/properties of which you set the access modifiers. See what comes into Intellisense and which not. Try debugging the application and see how it behaves. This is the best way for you to learn at this moment.

    Grz, Kris. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 7, 2008 9:19 AM