hi,

I am newbie at Perl.

I have written the following code in perl :-

sub point {             # point(x,y) constructor
  my ($x, $y) = @_;

  return (
    'x' => $x,          # components
    'y' => $y,
    'show' => sub {     # display method
         my %p = @_;
         print "point at $p{'x'},$p{'y'}\n";
      }
  );
}

sub show {              # method calling function
  my %shape = @_;
  $shape{'show'}(%shape);
}

show(point(1,2));

Is it anyway possible to Extend the above program with
constructors for rectangle and circle and a
non-virtual function "move" to change the reference
point of any of these objects.  

Can anybody help me with it..

it would be great...

have a good day...

cheers,

amrit.

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to