Skip to main content
I.am.Sceiffer
Participating Frequently
October 7, 2020
Question

ColdFusion 2018 update 10 does not interpret private functions

  • October 7, 2020
  • 1 reply
  • 136 views

I've found one more problem while creating a POO service.

 

I've created a component with some PRIVATE getter and setter functions, then a PUBLIC transactional function IN SAME component to access these getter and setter functions. After instancing the referenced object then using the transaction function, an error appears explaining the getter and setter functions could not be found. To avoid this error, I needed to change the getter and setter functions' visibility to PACKAGE. So, did anyone find a similar issue while creating a POO architecture using ColdFusion 2018?

    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    October 9, 2020

    The behaviour you describe makes sense to me. The CFC is the service. The one who instantiates the CFC is the client, presumed to be anywhere in the universe outside of the CFC. As such the client should know nothing about the private properties of the CFC. This is encapsulation or information-hiding, aspects of software design that transcend Pattern Object-Oriented architecture.