Simple Namespace Question

So I have a Namespace setup like this

Namespace 1

     Public Class A
     End Class

     Public Class B
     End Class

     Public Class C
     End Class

     Public Class D
     End Class

End Namespace

What I would like to do is only expose A,B and C and Make D only accessable to classes within the namespace.  I want to use D as a support class for A,B, and C but not allow it to be called directly.  

Any help would be great.  Thanks
Fred GoodwinVP of Software DevelopmentAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Hmm ... good question.  Not entirely sure.

Not a final answer, but -- a workaround for the moment is to make the class private and stick it into each of the public classes.  Obviously not a final answer -- I'll be interested to see if it's doable, how you want it -- but, you can always stick a private class into another class (as a helper class or whatnot -- just don't expose methods that require the class as a parameter or return type).

Non-public classes have to be within other classes ... and I don't know how Public Classes can be picky/choosy over who can call them.
Try declaring Class D as Protected instead of Public.

This site has a listing of the access specifiers and what they do.
I tried that and got a design-time error -- Protected types can only be declared inside of a class.
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Jens FiedererTest Developer/ValidatorCommented:

Define D as a protected class within superclass S

Let A, B, C Inherit from superclass S
Jens FiedererTest Developer/ValidatorCommented:
Other option is to declare A,B,C as "friend" classes of D

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Fred GoodwinVP of Software DevelopmentAuthor Commented:
Looks like this works best for what I was trying to do.  The SuperClass idea works but still opens me up more than I would like.

Thanks for the help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.