Reputation: 8637
I have base class with virtual method. And I have child class, which has override this method. Then I have child of child, but how I can override the same method? If I try to add 'virtual' to second class, I get message: 'Override method cannot be marked as virtual'. If I try to add 'override' to third class I get message: 'This is no suitable method for override'.
How to resolve this issue?
I can inherit third class from first, but actually I'd like to have some methods from second class.
public virtual T Save (T entity)
{
//removed code
return entity;
}
public override T Save(T entity)
{
//removed code
return entity;
}
public T Save(T entity)
{
return entity;
}
Upvotes: 1
Views: 1353
Reputation: 77616
Just override it (in the "child of child"). Overriding methods are implicitly virtual.
Upvotes: 6
Reputation: 98868
All overridden methods
are implicitly virtual. OVERRIDE THEM ALL!!!!
Upvotes: 1