Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Old School Object Oriented Perl.
Shape class must have color attibute only. Shape::Retangle and Shape::Circle should inherit from the Shape.
And
...
package Shape::Retangle;
use parent 'Shape';
sub new {
my ($class, $args) = @_; my $self = $class->SUPER::new( { color => $args->{color} || 'black' } ); $self->{length} = $args->{length} || 1; $self->{width} = $args->{width} || 1; return bless $self, $class;
package Shape::Circle;
my ($class, $args) = @_; my $self = $class->SUPER::new( {color => $args->{color} || 'black' } ); $self->{diameter} = $args->{diameter} || 1; return bless $self, $class;
There are no comments on this comment yet.
Shape class must have color attibute only. Shape::Retangle and Shape::Circle should inherit from the Shape.
And
...
package Shape::Retangle;
use parent 'Shape';
sub new {
}...
package Shape::Circle;
use parent 'Shape';
sub new {
}...