Let's say I have the following code:
interface ISomeInterface
{
void DoSomething();
void A();
void B();
}
public abstract class ASomeAbstractImpl : ISomeInterface
{
public abstract void A();
public abstract void B();
public void DoSomething()
{
}
}
public class SomeImpl : ASomeAbstractImpl
{
public override void A()
{
}
public override void B()
{
}
}
The problem is that I want the method to ASomeAbstractImpl.DoSomething()be sealed (final), so another class could not implement it. Since now the code SomeImplcan have a method called DoSomething(), and it can be called (it will not override the method with the same name from the abstract class, because it is not marked as virtual), but I would like to exclude the possibility of implementing such a method in the class SomeImpl.
Is it possible?
source
share