Re: by default, public or private?

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



Actually, no I'm right. You're only pointing out a semantical issue.

Since we're in the VB newsgroup, the posts about other languages don't
apply.


"Cerebrus99" <zorg007@xxxxxxxx> wrote in message
news:%23FXskuzMGHA.2992@xxxxxxxxxxxxxxxxxxxxxxx
Hi all,

"If the Dim statement is used (in Visual Basic .NET) or no access modifier
is used (in Visual C#), the variable is considered private in Visual C#
and
Visual Basic .NET classes, Public in Visual Basic .NET structures, and
private in Visual C# structures. Methods do not require an access
modifier.
If no access modifier is specified, the method is Private by default if in
a
class or structure in C#, and Public if in a class or structure in Visual
Basic .NET."

--- MCAD/MCSD Training Kit Windows Apps. Exam 70-306.

Joe wrote :
The variable is private to the module BUT public within the module.

Hi Joe,

I think you are not entirely right. There is no such thing as "public
within
the module". The definition of a private variable is one that is not
visible
*outside* of the type to which it belongs (Class or struct). "Private" is
the most you can limit the access level, and even all Private variables
can
be freely accessed within the class they are declared.

I believe it depends more on where the variable is declared.
Yes, you are right about that. As above, variables in VB.NET structures
are
by default Public.

"prefersgolfing" <prefersgolfing@xxxxxxxxxxx> wrote in message
news:uq#VGcxMGHA.1532@xxxxxxxxxxxxxxxxxxxxxxx
I'm trying to find on MSDN, or someplace, that speaks to variables being
public or private by default. Anyone know where? Thanks.






.



Relevant Pages

  • Re: by default, public or private?
    ... "If the Dim statement is used or no access modifier ... private in Visual C# structures. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Class private to a namespace
    ... default - only access from same package. ... Private and protected are available for nested types (and private is ... Private -- private variables can be used by any member or procedure w/i the ... ProtectedFriend -- Can only be used in classes. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Class private to a namespace
    ... default - only access from same package. ... Private and protected are available for nested types (and private is ... Private -- private variables can be used by any member or procedure w/i ... ProtectedFriend -- Can only be used in classes. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Need help with calling one class from another
    ... isn't accessing the private field, ... value to the nested class anyway. ... the nested class can see "private" members of the containing class, ... private variables. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Will python never intend to support private, protected and public?
    ... > language ... ... Well I have the following reasons not to like the current python way: ... Beginning all your private variables with an underscore is like ...
    (comp.lang.python)