Created
March 25, 2016 10:36
-
-
Save MicicFilip/0c293b8ac03cd12afda3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! C:\Strawberry\perl\bin\perl.exe | |
use warnings; | |
use strict; | |
use v5.010; | |
use prvi2; | |
my $op1 = new Vector(2, 1, 1); | |
my $op2 = new Vector(5, 1, 1); | |
say "-"; | |
say $op1->add($op2); | |
say "-"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! C:\Strawberry\perl\bin\perl.exe | |
use warnings; | |
use strict; | |
use v5.010; | |
package Vector; | |
sub new { | |
my $class = shift; | |
my $self = { | |
_x => shift, | |
_y => shift, | |
_z => shift | |
}; | |
sub add { | |
my ($self) = shift; | |
$self->{_x} += $self->{_x}; | |
#$self->{_x}++; | |
return $self->{_x}; | |
} | |
bless $self, $class; | |
return $self; | |
} | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment