Public.. Private...Static... Variable Scopes

ThePentiumGuy

Well-known member
Joined
May 21, 2003
Messages
1,113
Location
Boston, Massachusetts
hi

does anyone know of a variable scope that cannot be seen from another class, but can be used as an argument inside the same class?

for example - i tried this with Private

Code:
Public Class myClass

  Private Enum Example
     HI=1
     BYE=2
  End Enum


   Public Structure HeresTheProblem
      Dim Xample as Example
    End Structure

End Class

i want the Structure to be Public.. but it gives an error saying i cant make it Public while "Example" Is Private...

is there another scope for that?
 
The enumeration needs to be public in this case - if the structure is public and it refered to a private data type how would calling code know how to use the enumeration?
It may helkp if you gave a bit more information on why you need this, there may be another means to implement it.
 
You can use internal scope. But if youre going to compile all of your code into the same assembly (ie; not in a seperate .dll), then you might as well just make it public.

EDIT:
Actually, according to the definition on MSDN, protected scope may work. Your structure is within the same scope as your enum, and protected members are only accessible within the same class as its declared, and derived classes.

Give protected a shot, see if it works. If not, internal or public are your only other alternatives.
 
Back
Top