C
C#4mo ago
SWEETPONY

✅ what should I do to use derived class for return type?

I have following:
public abstract class CommandResult
{
public string Error { get; set; }
}

public abstract class CommandResult2 : CommandResult
{
public string Error { get; set; }
public string Data { get; set; }
}

public abstract class SolverManagerPureCommand<TArgument>
{
protected abstract Task<CommandResult> ExecuteInternalCoreAsync(TArgument argument);
}

public sealed class BuildDataSetCommand : SolverManagerPureCommand<string>
{
protected override Task<CommandResult> ExecuteInternalCoreAsync(string argument)
{
throw new NotImplementedException();
}
}
public abstract class CommandResult
{
public string Error { get; set; }
}

public abstract class CommandResult2 : CommandResult
{
public string Error { get; set; }
public string Data { get; set; }
}

public abstract class SolverManagerPureCommand<TArgument>
{
protected abstract Task<CommandResult> ExecuteInternalCoreAsync(TArgument argument);
}

public sealed class BuildDataSetCommand : SolverManagerPureCommand<string>
{
protected override Task<CommandResult> ExecuteInternalCoreAsync(string argument)
{
throw new NotImplementedException();
}
}
is it possible to return this?
protected override Task<CommandResult2> ExecuteInternalCoreAsync(string argument)
protected override Task<CommandResult2> ExecuteInternalCoreAsync(string argument)
0 Replies
No replies yetBe the first to reply to this messageJoin