Restrict Access of Class

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mustaq

    Restrict Access of Class

    Hi

    I have 2 Class i.e ClassA and ClassB, I want ClassB to be Accessed only by
    ClassA ONLY and nowhere in this project nor in other projects. How can I
    achieve this ?

    Regards,
    Mustaq

  • Jon Skeet [C# MVP]

    #2
    Re: Restrict Access of Class

    Mustaq <Mustaq@discuss ions.microsoft. com> wrote:[color=blue]
    > I have 2 Class i.e ClassA and ClassB, I want ClassB to be Accessed only by
    > ClassA ONLY and nowhere in this project nor in other projects. How can I
    > achieve this ?[/color]

    Make ClassB a private nested class within ClassA.

    --
    Jon Skeet - <skeet@pobox.co m>
    Pobox has been discontinued as a separate service, and all existing customers moved to the Fastmail platform.

    If replying to the group, please do not mail me too

    Comment

    • Mustaq

      #3
      Re: Restrict Access of Class

      Hi Jon Skeet,

      Thanks for your message, can you give me example in VB.NET

      Thanks
      & Regards,
      Mustaq

      "Jon Skeet [C# MVP]" wrote:
      [color=blue]
      > Mustaq <Mustaq@discuss ions.microsoft. com> wrote:[color=green]
      > > I have 2 Class i.e ClassA and ClassB, I want ClassB to be Accessed only by
      > > ClassA ONLY and nowhere in this project nor in other projects. How can I
      > > achieve this ?[/color]
      >
      > Make ClassB a private nested class within ClassA.
      >
      > --
      > Jon Skeet - <skeet@pobox.co m>
      > http://www.pobox.com/~skeet
      > If replying to the group, please do not mail me too
      >[/color]

      Comment

      • Cor Ligthert [MVP]

        #4
        Re: Restrict Access of Class

        Mustaq,

        This is the newsgroup "General" about dotnet.

        For language questions there are other newsgroups by instance.

        microsoft.publi c.dotnet.langua ges.vb

        In general Jon wrote
        Public class a
        friend class b
        end class
        end class

        I hope this helps,

        Cor


        Comment

        Working...