The Dopefly Tech Blog

« The Dopefly Tech Blog Main page

CFC: Expose Thyself

posted under category: ColdFusion on January 17, 2005 at 1:00 am by Nathan

Weird little thing I found. I thought it up a couple weeks ago when the cf-talk list was bickering about CFCs and good encapsulation and so on. Here's a way to undo it all in one quick swoop.

A CFC can expose all of its private data. Just have a method return variables. Every private member and method is now yours for the taking.

Hey here's some bad coding advice. Too lazy to make getters and setters for all your variables?

<cfset myCFC.getVariables().privateVar = "new value" />