I got a C# project where I need to have a base class and two sub classes and I want the sub classes to be private to the base classes. This is how it looks like:
public class MyBaseClass
{
public void doMyWork()
{
doSubClass1();
doSubClass2();
}
}
private class MySubClass1
{
public void doSubClass1()
{
//Do stuff
}
}
private class MySubClass2
{
public void doSubClass2()
{
//Do stuff
}
}
How i can i get this to work?
Does it hurt if the classes themselves are not-so-private but still wrapped in your base & unaccessible outside?
If this is not good enough and you need those in separate files, as you stated, then you can use partial classes, like so.
Class1.cs file
Class2.cs file
Class3.cs file
But still it's not quite clear what you are trying to achieve here.