public class CastTest {

  public static void main(String[] args) {
    ColorPoint cp = new ColorPoint(1, 2, "red");
    Point p = cp;                 // ワイドニング
    p.print();

    // 次の行をコメントアウトすると実行時エラー 
    // p = new Point(3, 4);
    ColorPoint q = (ColorPoint)p; // ナローイング
    q.color = "blue";
    q.print();
  }
}
