• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

coldfusion OO programming

New Here ,
Jun 29, 2007 Jun 29, 2007

Copy link to clipboard

Copied

Hi
At the moment i have a contact manager application i am building.
a contact has a title (mr/mrs/miss) and can have multiple addresses, multiple telephone numbers.

CFC's dont allow me to do multiple inheritance. I can extend to 1 component then extend to the next one in a kind of "daisy chain" but this is not ideal, if anything changes in my application there are a lot of dependencies.

I have been told by Hal Helms to use something called aggregation but I am finding this concept difficult to grasp.

I believe i am supposed to do something like the following see attached code:

This seems to work fine, i have a setTitle() method in the contact.cfc which creates the title object.

The problem is, as soon as i reference the setTitle() method from within the contact.cfc I can error saying that the return type is not of type "title"

I think i've either got this completely wrong or i'm missing something.

Can someone please help?

My e-mail address is here
TOPICS
Advanced techniques

Views

325

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Jun 29, 2007 Jun 29, 2007
You have set the type of your cfargument tag to be title, but as we can see from your attached code the path for this CFC is components.contact.title you need to change the type to that.

Votes

Translate

Translate
Engaged ,
Jun 29, 2007 Jun 29, 2007

Copy link to clipboard

Copied

You have set the type of your cfargument tag to be title, but as we can see from your attached code the path for this CFC is components.contact.title you need to change the type to that.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 29, 2007 Jun 29, 2007

Copy link to clipboard

Copied

Brilliant Simon, thanks, i just worked it out actually that i didnt have the path in the argument like you said.

Am I doing this all correctly, is it best practice?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jun 29, 2007 Jun 29, 2007

Copy link to clipboard

Copied

LATEST
These are the essentials of OOP with CFCs. As far as is this best practice I would have to see more of your code and your architecture.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation