title: How to pass reference to abstract class - Java
body: <pre><code>Data data = new Data("path"); //I read data from excel and save. This code is in Main.
  
  public abstract class Generator{
     public abstract double[][] generate();
     //here I need reference - data
     }
  
  public class GeneratorA extends Generator{
     public double[][] generate(){
     //first implementation - I want to work with data
     }
  }
  
  
  public class GeneratorB extends Generator{
     public double[][] generate(){
     //second implementation - I want to work with data
     }
  }
  </code></pre>
  
  <p>What I need is passing reference (data) to abstract class Generator. I can pass reference in constructors of GeneratorA/GeneratorB but I have more child classes and it is inefficient. Is any way how to pass reference data to abstr. class Generator? I just want to inherit reference from class Generator...
  Thanks!</p>