The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Name

SPVM::Point - Point

Usage

  use Point;
  
  my $point = Point->new;
  my $point = Point->new(1, 2);

  $point->set_x(1);
  $point->set_y(2);
  
  my $x = $point->x;
  my $y = $point->y;
  
  my $point_string = $point->to_string;

Description

Point is a class for a point.

Interfaces

Point class has the following interfaces.

Fields

x

  has x : rw protected int;

x.

y

  has y : rw protected int;

y.

Class Methods

new

  static method new : Point ($x = 0 : int, $y = 0 : int);

Create a new Point object with $x and $y.

Instance Methods

init

  protected method init : Point ($x = 0 : int, $y = 0 : int)

Initializes "x" and "y".

has_interfaces

  method has_interfaces : int ();

Returns 1.

clear

  method clear : void ();

Sets "x" and "y" to 0.

clone

  method clone : Point ();

Creates a new Point object that clones myself.

to_string

  method to_string : string ();

Stringifies the Point object as the following format.

  (1,2)