This may seem really stupid, but I am currently working on a project and it was going find but I then decided to rewrite some of my classes to make it easier to manage. Rather than only seperating my functions/classes into different categories, I decided to also seperate them by "level". I have low-mid-high level functions. High uses the mid level as mid uses the low level. Basically a form of abstraction.
Anyways, I was wondering if it was possible (or come close) to have a parent class that can do anything its child classes can, rather than the reverse which is how normal inheritance works. For example...
Class Parent
{
public void Print()
{
Console.WriteLine("I am the Parent");
}
}
Class Child
{
public void Run()
{
Console.WriteLine("Watch me Run!");
}
}
Parent p = new Parent();
p.Print();
p.Run() /* OR */ p.Child.Run();
Would I simply declare my child's functions as static or would that work? I know this seems silly but it actually makes sense to me. I can seperate my classes into seperate files rather than having one giant file with thousands of lines of code and I can do stuff like
"Earth.Asia.Japan.Tokyo" where function names are seperated into larger->smaller categories.
This scheme isnt nessisary for what I need though. Even
"Earth.Tokyo" without all the inbetween stuff would work fine. Basically what I am asking is if it is possible to have a parent class that inherits everything from its children so that way I can simply have one class to worry about instead of creating instances of all these child classes.
Is my thinking incorrect though? Is their some law of programming that states why something like this might be bad practice and why I should define all the child classes seperately? If I'm way off track, please tell.
Thanks.