Re: C++ friend class equivalent

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Chris, the internal keyword is equivalent to Friend in VB but
this is not what i want. internal allows that class or method
to be accessed outside the class but within the assembly.

I want to give an external class access to private methods in
my class, just as the friend keyword does in C++

c++ class

ie class A{
friend class B;
-----
}

here class B has access to all of A's private members and methods.

'internal' alows a member or method to be accessed outside class A

c# class

class A{
internal int var;
}

so its just a restricted version of public

I am new to CF but as AFAIK internal (C#) or Friend(VB)
is not the same as friend i nC++ which is what i want.

Also i don't want to make all my members and methods public or internal in
my class.

Hope this clarifies for you.



"<ctacke/>" <ctacke[@]opennetcf[dot]com> wrote in message
news:uCz8CbHlGHA.4200@xxxxxxxxxxxxxxxxxxxxxxx
it's internal in C#, so probably Internal in VB

-Chris


"Davis" <Davis_xx65@xxxxxxxxxxx> wrote in message
news:%23q1TAwGlGHA.4284@xxxxxxxxxxxxxxxxxxxxxxx
Hi, In VB if i want to define a class that has access to private
elements of another class how do i declare it. In C++ you
just use friend keyword.

As far as i understand the Friend keyword in VB allows that
particular element to be accessed outside the class but within an
assembly
which is not what i'm after.

Thanks





.



Relevant Pages

  • Re: Overloading == operator
    ... >After Adding keyword, friend, to the above declaration, the error disappear. ... in member function, operator== just need one parameter, because ...
    (comp.lang.cpp)
  • What is an assembly?
    ... I'm trying to figure out what the "Friend" keyword does. ... specifies that "elements are accessible from within the same assembly", ... defined in the help file anywhere. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Help -- New to Java
    ... You'll need a method name that isn't a keyword. ... I guess google is gonna be my friend. ... John T. ... My other computer is a swodniw machine ...
    (comp.lang.java.help)
  • ICE compiling template code
    ... I get ICE on the line that contains 'friend' keyword. ... int main{ ... friend void Function() ...
    (microsoft.public.vc.language)
  • Re: ICE compiling template code
    ... the line that contains 'friend' keyword. ... I've submitted a bug report. ... Please remove capital 'A's when replying by e-mail ...
    (microsoft.public.vc.language)