Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Using can With Inheritance

by JadeNB (Chaplain)
on Jul 22, 2008 at 23:19 UTC ( #699452=note: print w/replies, xml ) Need Help??

in reply to Using can With Inheritance

I think that you are manually implementing inheritance. The following code:
use strict; use warnings 'all'; package A; sub _write_file { print "Writing in package A\n"; } sub write_file { my $self = shift; $self->_write_file(@_); } package A::B; use base qw/A/; sub new { my $class = shift; bless {} => $class; } sub _write_file { print "Writing in package A::B\n"; } my $writer = A::B->new; $writer->write_file;
prints "Writing in package A::B" (followed by a newline, of course!), which seems to be what you want. The point is that, even though write_file is a method in package A, it's calling _write_file on an object blessed into package A::B. Am I misunderstanding what you're trying to do?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://699452]
[Eily]: the demonstration itself is fairly easy. The number of paths on a node is the sum of the numbers of paths to the two nodes above (or one node above on the edges of the triangle)
[Eily]: since the value of a node is also the sum from the two nodes above, you just have to demonstrate that the equality is true at the top of the triangle
[Discipulus]: yes Eily, thanks oiskuu but i dont get it.. ;=( maybe I'll ask a SOPW
[LanX]: all combinations with same amount of left and right?
[Eily]: if you want to store in a structure with the coordinates as key, arrays might do, since the keys are going to be 0..n
[LanX]: (Pascale path)
[Eily]: paths like that
[Discipulus]: yes Eily++ (very keen) I want to integrate my project with a 17th experiments. I want to colorize in sequence all paths
[oiskuu]: Yeah, modifry the recursive func combinations() to return not the number, but the paths themselves.
[Eily]: Discipulus I'd do that by starting from the bottom node I think. That way it can inherit the paths from the two nodes above (and so on, recursively)

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (9)
As of 2018-03-19 11:16 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (239 votes). Check out past polls.