I have a base class that I want to derive and instantiate together. I can do that in java like:
BaseClass derivedClassInstance = new BaseClass() {
@override
void someBaseClassMethod() { // my statements}
};
In python I can derive and and instantiate a base class like:
class DerivedClass(BaseClass):
def some_base_class_method():
# my statements
derived_class_instance = DerivedClass()
I need to sub-class single instances of some objects with minor changes. Deriving and assigning them separately seems like overkill.
Is there a Java-like one-liner way to derive and instantiate a class on the fly? Or is there a more concise way to do what I did in python?