samedi 6 janvier 2018

Can I name this example as an Adapter design Pattern? If 'No', Is any other design Pattern I can name for the same scenario?

Please help me in this.

I created an interface with m1,m2 methods. Let say I want flexibility for the class who wish to override these methods, Let say, either they want to override m1, m2, both or none. So My objective is to find out name of respective design pattern.

Can this example be a name of any design pattern? e.g Adapter etc.?

Interface

public interface AInterface {

    public void m1();

    public void m2();
}

abstract class

public abstract class AAbstract implements AInterface {

    public void m1() {  }

    public void m2() {  }

}

main

public class Main extends AAbstract {

    @Override
    public void m1() {
        System.out.println("I am m1");

    }

    public static void main(String[] args) {
        Main main = new Main();
        main.m1();

    }
}

Thanks in advance!!

Aucun commentaire:

Enregistrer un commentaire