Suppose I have two descendants of an abstract class:
object Child1 extends MyAbstrClass {
    ...
}
class Child2 extends MyAbstrClass {
}
Now I'd like to determine (preferably in the constructor of MyAbstrClass) if the instance being created is an object or something created by new:
abstract class MyAbstrClass {
    {
        if (/* is this an object? */) {
            // do something
        } else {
            // no, a class instance, do something else
        }
    }
}
Is anything like that possible in Scala? My idea is to collect all objects that descend from a class into a collection, but only object, not instances created by new.
 
     
    