Greetings fellow members, the situation in question is such:
public abstract class BaseClass
{
protected BaseClass()
{
// some logic here
}
protected BaseClass(Object parameter) : this()
{
// some more logic
}
}
public class Descendant : BaseClass
{
// no constructors
}
I'm trying to call Activator.CreateInstance on the Descendant class, but no constructor is found.
Do I need to explicitly define it on the Descentant class?
The bindings I've used are these: BindingFlags.Instance | BindingFlags.NonPublic
Note 1: I'm calling AppDomain.CreateInstanceAndUnwrap() in reality, if it should have some influence.
domain.CreateInstanceAndUnwrap(path, typeName, false, BindingFlags.Instance |
BindingFlags.NonPublic, null, new[] { parameter }, null, null);
Note 2: If I explicitly define the protected constructor in the Descendant class then it works, but I'd like to avoid this if possible.