Using abstract init() function in abstract class's constructor
<p>I have something like this:</p>

<pre><code>    public abstract class Menu {
     public Menu() {
      init();
     }

     protected abstract void init();

     protected void addMenuItem(MenuItem menuItem) {
      // some code...
     }
    }

    public class ConcreteMenu extends Menu {
     protected void init() {
      addMenuItem(new MenuItem("ITEM1"));
      addMenuItem(new MenuItem("ITEM2"));
      // ....
     }
    }

//Somewhere in code
Menu menu1 = new ConcreteMenu();
</code></pre>

<p>As you can see superclass's init method is abstract and is called by constructor automatically after object is created.</p>

<p>I'm curious if i can run into some sort of problems with code like this, when i need to create some object of this kind whose structure wont't be changed in time.</p>

<p>Would be any approach better? It works in Java, but will it work in C++ and possibly ActionScript?</p>

<p>Thank you for answer.</p>
