Java: Make a method abstract for each extending class

Posted by Martijn Courteaux on Stack Overflow See other posts from Stack Overflow or by Martijn Courteaux
Published on 2010-04-30T15:05:54Z Indexed on 2010/04/30 15:07 UTC
Read the original article Hit count: 237

Filed under:
|
|

Hi,

Is there any keyword or design pattern for doing this?

public abstract class Root
{
    public abstract void foo();
}

public abstract class SubClass extends Root
{
    public void foo()
    {
        // Do something
    }
}

public class SubberClass extends SubClass
{
    // Here is it not necessary to override foo()
    // So is there a way to make this necessary? 
    // A way to obligate the developer make again the override 
}

Thanks

© Stack Overflow or respective owner

Related posts about java

Related posts about keywords