I'm developing a C # application for Unity 3D where it will manage various database types (Mysql, Postgress ...), the problem is that I have classes that manipulate each type of database within my namespace, which are used by several other classes, the problem that these classes do not want to be instantiated outside my namespace, but inside I wanted it to be free to use. In Java, suffice to say that it was protected that everything was fine, but that's not how it works in C #. Java Example:
namespace MDC {
protected class Mysql {
public Mysql(){}
}
public class Database {
public Database(){
new Mysql(); // Sucesso
}
}
}
public class MainClass {
public static void Main (string[] args) {
new Database(); // Sucesso
new Mysql(); // Erro
}
}