Hi all -
I just did a cfdump of a cfc I instantiated, and within that
dump I see all the methods returned as well as the instance data.
This leads me to believe that each instance contains its own copy
of the cfc's methods.
Methods (at least the ones I'm using) within a cfc are going
to be exact duplicates from one instantiation to the next, as only
the instance data within the CFC is unique per instance, and I'm
concerned about the extra overhead/memory required to deliver all
methods to all instances. I am wondering if there is a way that the
methods can be created just once and shared by each instance. I
know I can simply define shared-scope UDF's that each CFC instance
can reference externally, but that defeats the benefit of having
related code defined in one spot - which is a big benefit of CFC's,
and goes against the "best practice" of encapsulation. I also tried
to just define methods in the CFC with a shared-scope name, but
that causes a CF error. It would be great if there was a way to
define a CFC or method to accomplish this.
Has anyone come up with a good way to do this? Possibly there
is a well-known solution of which I am woefully ignorant.
Any pointers (no pun intended) would be greatly appreciated.