HI
Any one tell me with example is our class is by default private or public....?
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Jun 29, 2011, 4:50 AM EDT
class MyClass // internal, so only visible to code within same assembly
{
class MyNestedClass // private, so only visible to code within MyClass
{
}
}
Suthish NairRank #92 · 22.8K reputationPosted Jun 29, 2011, 7:05 AM EDT
Suthish NairRank #92 · 22.8K reputationPosted Jun 29, 2011, 7:06 AM EDT
VulpesRank #55 · 29.2K reputationPosted Jun 29, 2011, 9:22 AM EDT
However, nested classes can be public, internal, protected internal, protected or private in C#.
Sam HobbsRank #107 · 20.5K reputationPosted Jun 29, 2011, 4:56 PM EDT
Types declared in compilation units or namespaces .... default to internal declared accessibility.
Which is the same as what Vulpes said. It also says much more in case you want to try to read it. There is even sample code there.
You might want to start with "8.7 Classes"; it has some useful sample code.