Covariant problem

Zarathustra adam.chrapkowski at gmail.com
Thu Jul 24 06:10:56 PDT 2008


Ok, more code :P beacuse problem is only with arrays.
class CPolygon3d{
  //______________________________________
  //  ::>> Attributes <<::
  //
 
  //______________________________________
  //  << fields >>
  //...
  private CPoint3d [] m_points;
  //...

  //______________________________________
  //  << properties >>
  //...

  // property getPoint
  //______________________________________
  public CPoint3d getPoint(){ return this.GetPoint; }

  // property getPoints
  //______________________________________
  public CPoint3d [] getPoints(){ return this.GetPoints; }

  //...
 
  //______________________________________
  //  ::>> Methods <<::
  //
   
  //...
 
  //______________________________________
  //  << operations >>

  //...

  // operation GetPoint
  //______________________________________
  private CPoint3d
  GetPoint()
  in{
    //...
  }
  out{
    //...
  }
  body{
    //...
  }

  // operation GetPoints
  //______________________________________
  private CPoint3d []
  GetPoints()
  in{
    //...
  }
  out{
    //...
  }
  body{
    //...
  }
}
 
class CPolygon2d : CPolygon3d{
  //______________________________________
  //  ::>> Attributes <<::
  //

  //______________________________________
  //  << fields >>
  //...
  private CPoint2d [] m_points;
  //...

  //______________________________________
  //  << properties >>
  //...

  // property getPoint
  //______________________________________
  public CPoint2d getPoint(){ return this.GetPoint; }  // ok
 
  // property getPoints
  //______________________________________
  public CPoint2d [] getPoints(){ return this.GetPoints; } // problem

  //...

  //______________________________________
  //  ::>> Methods <<::
  //
  
  //...

  //______________________________________
  //  << operations >>

  //...

  // opeartion GetPoint
  //______________________________________
  private CPoint2d
  GetPoint()
  in{
    //...
  }
  out{
    //...
  }
  body{
    //...
  }

  // opeartion GetPoints
  //______________________________________
  private CPoint2d []
  GetPoints()
  in{
    //...
  }
  out{
    //...
  }
  body{
    //...
  }

}


More information about the Digitalmars-d-learn mailing list