문제

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....
}
도움이 되었습니까?

해결책

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....
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top