[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] (QXP => HTML) && OOP



At 0.40 97/3/28, Richard Pfeiffer wrote:
>The question is: How do you create new members in a class without using a
>unique variable for each one?  Or, alternatively, how do you refer to an
>anonymous class member by the value of one of its properties (such as Name,
>for instance)?

I think that because of the magic used in bless(), you have to create a new
variable for each new object.  Like if you do this:

my $Style1 = new Style_Sheet("Body_Text", 12, "Times");
my $Style2 = $Style1;
$Style2->Name('Head'); # given you have a method called Name

print $Style1->Name; #prints 'Head'

I think you have to create a new object each time if you want to use more
than one at a time.

As to the second question, I'm not sure how you mean.

#================================================================
Chris Nandor                                      pudge@pobox.com
PGP Key 1024/B76E72AD                           http://pudge.net/
Keyfingerprint = 08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6