<?php
class Point {
private $x=0;
private $y=0;
public function setPoint($x,$y){
$this->x=$x;
$this->y=$y;
}
public function showPoint(){
echo "(", $this->x,",", $this->y,")\n";
}
}
class Line {
private $p1;
private $p2;
public function setLine($p1,$p2){
$this->p1=$p1;
$this->p2=$p2;
}
public function showLine(){
$this->p1->showPoint();
$this->p2->showPoint();
}
}
$p1=$p2=new Point;
$p1->setPoint(5, 8);
$p2->setPoint(1, 2);
$l=new Line;
$l->setLine($p1, $p2);
$l->showLine();
PD9waHAKY2xhc3MgUG9pbnQgewogICAgcHJpdmF0ZSAkeD0wOwogICAgcHJpdmF0ZSAkeT0wOwogICAgcHVibGljIGZ1bmN0aW9uIHNldFBvaW50KCR4LCR5KXsKICAgICAgICAkdGhpcy0+eD0keDsKICAgICAgICAkdGhpcy0+eT0keTsKICAgIH0KICAgIHB1YmxpYyBmdW5jdGlvbiBzaG93UG9pbnQoKXsKICAgICAgICBlY2hvICIoIiwgICR0aGlzLT54LCIsIiwgICR0aGlzLT55LCIpXG4iOwogICAgfQp9CmNsYXNzIExpbmUgewogICAgcHJpdmF0ZSAkcDE7CiAgICBwcml2YXRlICRwMjsKICAgIHB1YmxpYyBmdW5jdGlvbiBzZXRMaW5lKCRwMSwkcDIpewogICAgICAgICR0aGlzLT5wMT0kcDE7CiAgICAgICAgJHRoaXMtPnAyPSRwMjsKICAgIH0KICAgIHB1YmxpYyBmdW5jdGlvbiBzaG93TGluZSgpewogICAgICAgICR0aGlzLT5wMS0+c2hvd1BvaW50KCk7CiAgICAgICAgJHRoaXMtPnAyLT5zaG93UG9pbnQoKTsKICAgIH0KfQokcDE9JHAyPW5ldyBQb2ludDsKJHAxLT5zZXRQb2ludCg1LCA4KTsKJHAyLT5zZXRQb2ludCgxLCAyKTsKJGw9bmV3IExpbmU7CiRsLT5zZXRMaW5lKCRwMSwgJHAyKTsKJGwtPnNob3dMaW5lKCk7