Re: by default, public or private?
- From: "Joe Sutphin" <joesutphin@xxxxxxxxxxxxx>
- Date: Thu, 16 Feb 2006 16:19:12 -0500
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.
.
- Follow-Ups:
- Re: by default, public or private?
- From: Cor Ligthert [MVP]
- Re: by default, public or private?
- References:
- by default, public or private?
- From: prefersgolfing
- Re: by default, public or private?
- From: Cerebrus99
- by default, public or private?
- Prev by Date: Re: Property of List of Classes
- Next by Date: Re: Replace Selected Text
- Previous by thread: Re: by default, public or private?
- Next by thread: Re: by default, public or private?
- Index(es):
Relevant Pages
|