Design Patterns Java - Bridge Php

1) What have we done?

We created "ChildAB" and there we inherit after "ChildA"


public class ClassAB extends ClassA
{
    public void doB()
    {
        doStep2();
        doStep3();
        doStep1();
    }
}

public class ChildAB extends ChildA
{
    public void doB()
    {
        doStep2();
        doStep3();
        doStep1();
    }
}




2) Is it proper situation ?

Unfortunately not, it looks bad, in "ClassAB" and in "ChildAB" we have a code duplication which we can't remove.

But we can use the "Bridge" pattern.

"Bridge" pattern separate implementation from interface.
We just move implementation of "doStep1", "doStep2", "doStep3" to another hierarchy class.