in reply to Foo::Button->new vs. newButton()

One of the cool thing about objects is how it keeps the namespaces all clean.

What if you wanted to use two different classes, both of which wanted to call their constructor newButton? Bad news. By using a method in that namespace, it's easier.

Also, what if you wanted to subclass that class, and add extra behavior during the object instantiation? With named constructors, it's harder.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on •Re: Foo::Button->new vs. newButton()