This content has been marked as final. Show 3 replies
> 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.
It is my understanding that this is how it actually works under the
hood, no work needed on your part. Yes when you dump the component, all
the methods are listed there. But the same method in multiple instances
of the component all use the same code in one memory location, they all
just get their own pointer to that place.
I am by know means an authority on this, but that is my understanding
from my readings.
Ian is correct. Instances just contain a pointer, not separate copies of the method. You can test this by creating several instances of a single component and reviewing the hashcode values. They should all be the same.
<cfset comp1 = createObject("component", "MyComponent").init("a")>
<cfset comp2 = createObject("component", "MyComponent").init("b")>
<cfset comp3 = createObject("component", "MyComponent").init("c")>
Thanks to both of you. I couldn't have hoped for a better answer.