Trouble With Access Modifiers
-
What access modifier would I use so that: Functions within the class have read and write access to the subject & Anything external has read-only access? Many thanks with this stumping question, Fahad Sadah
-
What access modifier would I use so that: Functions within the class have read and write access to the subject & Anything external has read-only access? Many thanks with this stumping question, Fahad Sadah
Marking a method as
Private
means it can only be accessed by code within the current class. Marking a method asFriend
means it can only be accessed by code within the current assembly. Hope this helps.Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush
-
What access modifier would I use so that: Functions within the class have read and write access to the subject & Anything external has read-only access? Many thanks with this stumping question, Fahad Sadah
Since .NET 2.0 C# supports properties with different access modifiers for thet get and the set part, so you could have a public get and a private set. Not sure how it is in VB.NET tho. If it is not available, you can always make your own public Get and private Set methods! :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use PRE tags to preserve formatting when showing multi-line code snippets
-
Since .NET 2.0 C# supports properties with different access modifiers for thet get and the set part, so you could have a public get and a private set. Not sure how it is in VB.NET tho. If it is not available, you can always make your own public Get and private Set methods! :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use PRE tags to preserve formatting when showing multi-line code snippets
There is
get
andset
in VB.NET"The clue train passed his station without stopping." - John Simmons / outlaw programmer
-
There is
get
andset
in VB.NET"The clue train passed his station without stopping." - John Simmons / outlaw programmer
Paul Conrad wrote:
There is get and set in VB.NET
Yes Paul, I am aware of that, but what I don't know is whether they can have different access modifiers, as was introduced in C# 2.0 :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use PRE tags to preserve formatting when showing multi-line code snippets
-
Paul Conrad wrote:
There is get and set in VB.NET
Yes Paul, I am aware of that, but what I don't know is whether they can have different access modifiers, as was introduced in C# 2.0 :)
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use PRE tags to preserve formatting when showing multi-line code snippets
I think they can. But, I could be wrong.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
-
I think they can. But, I could be wrong.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
Very informative. Or need I something to decrypt?
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use PRE tags to preserve formatting when showing multi-line code snippets
-
Very informative. Or need I something to decrypt?
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use PRE tags to preserve formatting when showing multi-line code snippets
Luc Pattyn wrote:
Very informative.
:laugh: Sorry :-O
Luc Pattyn wrote:
need I something to decrypt?
Nope. No rijndael or anything like that. Just opening up VS right now to see if it can be done...
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
-
Luc Pattyn wrote:
Very informative.
:laugh: Sorry :-O
Luc Pattyn wrote:
need I something to decrypt?
Nope. No rijndael or anything like that. Just opening up VS right now to see if it can be done...
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
Thanks everyone, trying it now! EDIT: Works perfectly! THANKS!