public interface IAutomatizableEvent
{
Event AutomatizableEventItem { get; }
bool CanBeAutomatic { get; }
bool IsAutomaticallyRunning { get; }
bool OnBeforeAutomaticCall();
bool OnAutomaticCheck();
void OnAutomaticStart();
void OnAutomaticCancel();
}
public abstract class AutomatizableEvent : IAutomatizableEvent
{
public AutomatizableEvent()
{
}
#region Implementation of IAutomatizableEvent
public abstract Event AutomatizableEventItem { get; }
public abstract bool CanBeAutomatic { get; }
public abstract bool IsAutomaticallyRunning { get; }
public abstract bool OnBeforeAutomaticCall();
public abstract bool OnAutomaticCheck();
public abstract void OnAutomaticStart();
public abstract void OnAutomaticCancel();
#endregion
}
public static class EventSystem
{
public static List<EventSystemBase<Event, AutomatizableEvent>> AutomatizableEvents { get; set; }
[...]
}
"The type 'AutomatizableEvent' must have a public parameterless constructor in order to use it as parameter 'K' in the generic class 'EventSystemBase'"
public abstract class EventSystemBase<T, K> : AutomatizableEvent
where T : Event
where K : AutomatizableEvent, new()
My question is ... doesn't AutomatizableEvent DO HAVE a public parameterless constructor??
new()
constraint, you must be able to initialize the class with=new AutomatizableEvent()
which you can't as it is abstract. Create a concrete child class and use that instead. – John Alexiou