Pergunta

I am not sure what the problem is but what I'm trying to do is to pass argument to a base constructor from a derived class's

error:

Invalid token 'base' in class, struct, or interface member declaration

here is my base class code:

public class EmployeeRegistrationBase
{
    //constructor
    public EmployeeRegistrationBase(string methodName)
    {
       //more code...
    }
}

here is my derived class:

public class USER_REG_LOG_INFO  : base(EmployeeRegistrationBase("some_method_name"))
{
     //more code....
}
Foi útil?

Solução

Your syntax for inheritance and the constructor passthrough are incorrect. Try this instead:

public class USER_REG_LOG_INFO  : EmployeeRegistrationBase
{
     public USER_REG_LOG_INFO() : base("some_method_name")
     {
     }

     //more code....
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top