so basically I have a this code where classes extends over a base class
class CommandBase {
doCommand(){
// Do command thing.
}
}
class Help extends CommandBase{
}
class Kick extends CommandBase{
}
class Ban extends CommandBase{
}
class Chat extends CommandBase{
}
now throughout the production of the program more and more commands will be added that extends the CommandBase class, is there any way via reflection I can just get all classes the extends the CommandBase classes without to explicitly write them in an array or keeping track of them by writing manually on code? I want to have something like this in C#:
AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(s => s.GetTypes())
.Where(p => type.IsAssignableFrom(p))
Can nodeJS do this? is there any specific reflection library for it?
Aucun commentaire:
Enregistrer un commentaire