Created
September 24, 2014 06:06
-
-
Save bessarabov/650c0099e7a14ed18c5e 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
#!/usr/bin/perl | |
use strict; | |
use warnings FATAL => 'all'; | |
use utf8; | |
use open qw(:std :utf8); | |
package Animal; | |
sub new { | |
my ($class) = @_; | |
my $self = {}; | |
bless $self, $class; | |
return $self; | |
} | |
sub walk { | |
my ($self) = @_; | |
print "I'm walking\n"; | |
return; | |
} | |
sub set_name { | |
my ($self, $name) = @_; | |
$self->{_name} = $name; | |
return; | |
} | |
package Human; | |
use base 'Animal'; | |
sub say { | |
my ($self) = @_; | |
print "Hello, world!"; | |
return; | |
} | |
package main; | |
sub main { | |
my $person = Human->new(); | |
$person->set_name('Борис'); | |
use Data::Dumper; | |
print Dumper $person; | |
} | |
main(); | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment