title: An array of child objects
body: <p>I created a parent class that i named <strong>Courrier</strong> </p>
  
  <pre><code>public class Courrier {
  private double poid;
  private boolean expr;
  String ad;
  private char z ;
  public Courrier(double poid, boolean expr, String ad, char z) {
      this.poid = poid;
      this.expr = expr;
      this.ad = ad;
      this.z = z;
  }
  public double getPoid() {
      return poid;
  }
  public boolean isExpr() {
      return expr;
  }
  public String getAd() {
      return ad;
  }
  public char getZ() {
      return z;
  }}
  </code></pre>
  
  <p>and two children classes both contains a method named <code>affranchir()</code>
  then there is a class <strong>Test</strong>:</p>
  
  <pre><code>public class Test {
  public static void main(String[] args) {
      Courrier[] T = new Courrier[4];
      T[0] = new Lettre(200, true, "London", 'C', "A3");
      T[1] = new Colis(3000, false, "Barcelone", 'B', 50);
      T[2] = new Lettre(500, false, "Béchar", 'A', "A4");
      T[3] = new Colis(150, true, "New york", 'C', 175);
      double tarif=0;
      for (int i = 0; i &lt; T.length; i++) {
              System.out.println(T[i].affranchir());
              tarif+=T[i].affranchir();
      }
      System.out.println(tarif);
  }}
  </code></pre>
  
  <p>well there is a problem it says 
  The method <code>affranchir()</code> is undefined for the type <strong>Courrier</strong>
  and i want to make it work without casting is there any possible way please ?</p>