Created
September 24, 2014 06:06
-
-
Save bessarabov/4b00b896b2d4e9921c6c 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 DDP; | |
p $person; | |
} | |
main(); | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment