Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
47
Task/Inheritance-Single/Perl/inheritance-single.pl
Normal file
47
Task/Inheritance-Single/Perl/inheritance-single.pl
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
package Animal;
|
||||
#functions go here...
|
||||
1;
|
||||
|
||||
package Dog;
|
||||
use Animal;
|
||||
@ISA = qw( Animal );
|
||||
#functions go here...
|
||||
1;
|
||||
|
||||
package Cat;
|
||||
use Animal;
|
||||
@ISA = qw( Animal );
|
||||
#functions go here...
|
||||
1;
|
||||
|
||||
package Lab;
|
||||
use Dog;
|
||||
@ISA = qw( Dog );
|
||||
#functions go here...
|
||||
1;
|
||||
|
||||
package Collie;
|
||||
use Dog;
|
||||
@ISA = qw( Dog );
|
||||
#functions go here...
|
||||
1;
|
||||
|
||||
# The same using the [http://search.cpan.org/perldoc?MooseX::Declare MooseX::Declare] module:
|
||||
|
||||
use MooseX::Declare;
|
||||
|
||||
class Animal {
|
||||
# methods go here...
|
||||
}
|
||||
class Dog extends Animal {
|
||||
# methods go here...
|
||||
}
|
||||
class Cat extends Animal {
|
||||
# methods go here...
|
||||
}
|
||||
class Lab extends Dog {
|
||||
# methods go here...
|
||||
}
|
||||
class Collie extends Dog {
|
||||
# methods go here...
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue