PC Review


Reply
Thread Tools Rate Thread

default access modifier for a sub or a function when not set

 
 
Mark Kamoski
Guest
Posts: n/a
 
      23rd Jul 2003


Hi--

Please help.

What is the default access modifier value for a Sub or a Function when one
has not explicitly been set.

In MSDN, in "Access Types", it states...

"If no access modifier has been specified, the default access type depends
on the declaration context"

....which, although interesting, is somewhat less than direct.

Let's suppose a simple case. There is an ASPX page as the UI and an ASPX.VB
page as the code-behind logic. Now, if someone opens that ASPX.VB file and
simply writes a method such as...

Sub DoSomething()

'...

End Sub

....what default access modifier is applied to this method?

Please advise.

Thank you.

--Mark



 
Reply With Quote
 
 
 
 
Herfried K. Wagner
Guest
Posts: n/a
 
      23rd Jul 2003
Hello,

"Mark Kamoski" <(E-Mail Removed)> schrieb:
> What is the default access modifier value for a Sub
> or a Function when one has not explicitly been set.

[...]
> simply writes a method such as...
>
> Sub DoSomething()
>
> '...
>
> End Sub
>
> ...what default access modifier is applied to this method?


\\\
Class Foo
Sub Bla()
End Sub
End Class
///

will declare Foo as Friend and Bla as Public. Open the object browser
to check the modifier. I always specify the modifier...

;-)

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Default class access modifier Man T Microsoft C# .NET 4 19th Feb 2009 10:42 PM
what is the default access modifier in the class if not specified puzzlecracker Microsoft C# .NET 8 25th Sep 2008 05:08 AM
default access modifier Tony Microsoft C# .NET 5 29th Feb 2008 02:22 PM
VB default class access modifier Dan Disney Microsoft Dot NET 2 27th Nov 2003 09:39 PM
Default type access modifier Jacob N. Rohde Microsoft C# .NET 1 24th Sep 2003 08:23 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:50 AM.