0

I'm trying to inherit the constructor of a derived class from a base class but it keeps throwing errors.

public class QueryExecutor
{
    private readonly Uri uri;
    private readonly string personalAccessToken;
    private readonly VssBasicCredential credentials;

    public QueryExecutor(string url, string orgName, string personalAccessToken)
    {
        this.uri = new Uri(url + orgName);
        this.personalAccessToken = personalAccessToken;
        this.credentials = new VssBasicCredential(string.Empty, personalAccessToken);
    }
}

public class TestString : QueryExecutor {
//I don't care about this and just need it to do what the base class constructor does as succinctly as possible
    public TestString(string url, string orgName, string personalAccessToken) : QueryExecutor(string url, string orgName, string personalAccessToken) { };
}

This matches the pattern other StackOverflow answers suggested, but it throws errors "TestString.TestString must declare a body because it is not marked abstract, extern, or partial", "keyword this or base suggested", "method must have a return type", "there is no argument given that corresponds to the required formal parameter "url' of QueryExecutor.QueryExecutor"

Nathan Dehnel
  • 133
  • 10

0 Answers0