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