8. วัตถุสิ่งของ

The Camtasia Studio video content presented here requires JavaScript to be enabled and the latest version of the Macromedia Flash Player. If you are you using a browser with JavaScript disabled please enable it now. Otherwise, please update your version of the free Flash Player by downloading here.

 
รหัสที่ 8-30  การเขียนคำสั่งในตัวสร้างที่มีการเรียกตัวสร้างอื่น โดยใช้ชื่อคลาสซึ่งผิด
public class Ball {
  ...
  public Ball(double r0, double x0, double y0) {
    Ball(r0, x0, y0, random(-3,3), random(-3,3));
  }
  public Ball(double r0,double x0,double y0,double dx0,double dy0){
    r = r0;  x = x0; y = y0;  dx = dx0; dy = dy0;
  }
©2009 S.Prasitjutrakul