Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Abstract Factory

by BUU (Prior)
on Oct 04, 2005 at 00:02 UTC ( [id://497092]=note: print w/replies, xml ) Need Help??


in reply to Abstract Factory

package Factory; sub get_new { my( $class, $type ) = @_; return $type->new; }
Am I missing anything?

Replies are listed 'Best First'.
Re^2: Abstract Factory
by Khatri (Scribe) on Oct 05, 2005 at 17:10 UTC
    so $class will have name of the class and $type will have type of class suppose I have class A, clas B,... if I want to have new class a of type A should I get by get_new(a,A); is that correct ?
      Not quite. It's designed to be a class method, so you would call it like: Factory->get_new("A") which implicitly sends "Factory" as the first argument to the method.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://497092]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (1)
As of 2024-04-24 14:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found