Unable to mole clasess which use new keyword in inherited methods

308 views Asked by At

I have the following scenario

public abstract ClassA{
   public virtual void Initialize(string a, int b){
   }
}

public abstract ClassB : ClassA{
   public virtual int Initialize(string a, int b){
   }
}

When I try to create stub for Class B, I receive the error saying that SClassB already defines a member called 'Initialize' with the same parameter types.

How do I resolve the issue?

Thanks, Sathish

1

There are 1 answers

2
Pengtuzi On

As far as I know, you can not override within an abstract class so you would either need to lose the abstract/virtual and use override modifier on ClassB, or override it in the class(es) that inherits from ClassB.