ThePentiumGuy Posted January 24, 2004 Posted January 24, 2004 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 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? Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
Administrators PlausiblyDamp Posted January 24, 2004 Administrators Posted January 24, 2004 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
wyrd Posted January 24, 2004 Posted January 24, 2004 You can use internal scope. But if you're 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 it's declared, and derived classes. Give protected a shot, see if it works. If not, internal or public are your only other alternatives. Quote Gamer extraordinaire. Programmer wannabe.
ThePentiumGuy Posted January 24, 2004 Author Posted January 24, 2004 internal scope works :-D thanks Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.