I think you'll find answers to most of your questions here:
http://msdn.microsoft.com/library/de...ethodscope.asp
Protected means that only the class itself and classes which inherit from it
can call the member (member being a field/property/method). Friend means
that any code within the same assembly (dll/project) can call the member .
These are frequently called access modifiers. The other ones are public
(anyone can call it) and private (only the class itself can call it). You
can also have a mix of protected friend, meaning only the class itself,
classes which inherit from it, or classes within the same DLL can call the
member .
Shared is something entirely different. It denotes that a member doesn't
apply to an instance of a class. For example, given:
public class Test
public function Add(number1 as integer, number2 as integer) as integer
return number1 + number2;
end function
public shared function Multiply(number1 as integer, number2 as integer)
as long
return number1 * number2;
end function
end class
You can call the 2nd one (not shared) simply by doing:
dim value as long = Test.Multiply(1,2)
to call the 1st one, you need an instance of Test:
dim t as new Test()
dim value as integer = t.Add(1,2)
note how the 1st is done on an instance (t) of Test, whereas the 2nd one is
simply called on the class.
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
<an*******@discussions.microsoft.com> wrote in message
news:a4****************************@phx.gbl...
hello there,
what is the difference between Shared and Protected
Shared? where can I read more about theses kind of
variables (or whatever they are....sorry, don't know the
word in eng.)
Thanks.