title: How can I force a Constructor to be defined in all subclass of my abstract class
body: <p>I have an abstract class A that define abstract methods. This means that, for a class to be instanciable, all the abstract method have to be implemented.</p>
  
  <p>I'd like all my subclasses to implement a constructor with 2 ints as parameters. </p>
  
  <p>Declaring a constructor defeats my purpose, as I want the constructor defined in subclasses and I don't know anything about the implementation. Moreover I cannot declare a constructor as being abstract;</p>
  
  <p>Is there a way to do this ?</p>
  
  <p><strong>Example of what I want:</strong></p>
  
  <p>Lets say that I am defining the API of a Matrix class. In my problem, Matrix cannot change their dimensions.</p>
  
  <p>For a Matrix to be created, I need to provide its size.</p>
  
  <p>Hence, I want all my implementors to provide the constructor with the size as a parameter. This constructor is motivated by the problem, not by an implementation concern. The implementation can do whatever it wants with these, provided that all the semantic of the methods are kept.</p>
  
  <p>Let's say I want to provide a basic implementation of the <code>invert()</code> method in my abstract class. This method will create a new matrix with <code>this</code> inverted dimensions. More specifically, as it is defined in the abstract class, it will create a new instance of the same class as <code>this</code>, using a constructor that takes two ints. As it does not know the instance it will use reflection (getDefinedConstructor) and I want a way to waranty that I'll get it and that it will be meaningfull for the implementation.</p>