import 'dart:math' ;
class Point{
Point(this.x,this.y);
distanceTo(other){
var dx= x-other.x;
var dy= y-other.y;
return sqrt(dx*dx+dy*dy);
}
var x,y;
}
main(){
var p= new Point(2,3);
var q= new Point(3,4);
print('distance from p to q =${p.distanceTo(q)}');
}
网友评论