Dean,

Byron's suggestion is a good one, and the right way to go unless you use an
IoC container. It's an object-oriented programming idea where, when you
come to the point of not wanting to instantiate all your objects. You
invert the control of creating away from what normally creates them into
some kind of bean factory. There are a number of them out there for
ColdFusion. ColdSpring, WireBox, and DI/1 to name the big ones off the top
of my head. An ioc container/factory will keep it all internally for you,
wire your bean up, then hand you what you asked for, all ready to go.

The only other solution is to send in your utility object each time you
create something that needs it.

On Fri Feb 06 2015 at 1:24:38 PM Dean Lawrence <[email protected]> wrote:

>
> Thanks Byron,
>
> I wasn't wanting my utility class to inherit my base class, I am wanting to
> inject the utility class into the base class. I'm trying to get away from
> explicitly defining the utility class from within the base class. Since the
> base class is not called directly, I don't know how to pass the utility
> class in as a required argument during initialization.
>
> On Fri, Feb 6, 2015 at 12:11 PM, Byron Mann <[email protected]> wrote:
>
> >
> > Think you might want something like this in your base cfc? I think you'd
> > not want the UtilClass to inherit the base class however, or this would
> > lead to a circular reference and probably kill the app.
> >
> > component name='baseClass' {
> >
> >  variables.utilClass = new UtilClass();
> >
> > }
> >
> >
> >
>
> --
>
>   [image: profile picture]  *Dean Lawrence*
> *President*
> Internet Data Technology
> *Phone:* 888-438-4381 x701
> *Web:* www.idatatech.com
> *Email:* [email protected]
>   Programming | Database | Consulting | Training
>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:360065
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to