Question
Is there a feature that some language makes available to be able to add a class to the running software, that is, the software to be recognized in order to instantiate objects of this class and manipulate them?
Let's imagine the following situation:
Take the Java language with example. We have this abstract class made available as a skeleton so that users can implement:
public abstract class TypeGeneral {
MyAttribute my_atr; // um objeto qualquer que toda implementação
// de TypeGeneral tem que ter
public General(MyAttribute e) {
my_atr = e;
}
public abstract void run(); // <==
public MyAttribute getAttr() { /*...*/ }
public MyAttribute setAttr(MyAttribute e) { /*...*/ }
// ...
}
I wanted to know if there is a resource that gives the possibility that, after the user has made their class extending TypeGeneral
, and thus implementing the run()
method, can at runtime add it to the system which is running, and the system, recognizing it, makes manipulations with its objects.
I saw something about Reflection
, but I could not adapt to my problem. Anyone willing?
Preferred languages
-
Java
-
Python
-
C#
-
C++