Author Topic: Pass by value or reference semantics  (Read 953 times)

ajaxx

  • EA User
  • **
  • Posts: 32
  • Karma: +0/-0
    • View Profile
Pass by value or reference semantics
« on: October 18, 2004, 01:54:09 pm »
Greetings,

I'm certain I'm missing something somewhere.  I'm working on a class diagram and I have two classes A and B.  A has a qualified association with B and as such wants to declare a method getFoo( string name) that return a reference to B.  (I have set the language for the diagram and components to C++).  Now if I do nothing special, it adds B and will generate return by value.  If I change this to B& it does what you'd expect, but if I happen to change the name of B to reflect some change in naming scheme it will not update it elsewhere.

Its not going to kill me, but if I have a commonly used construct that is pass by reference then this can be a nightmare (name my classes right the first time eh?).

Is this just something I should be prepared to deal with or am I missing something fundamental in the tool.

Javier

  • EA User
  • **
  • Posts: 67
  • Karma: +0/-0
  • Necessity is the mother of email
    • View Profile
Re: Pass by value or reference semantics
« Reply #1 on: November 10, 2004, 11:25:28 pm »
Quote
Is this just something I should be prepared to deal with or am I missing something fundamental in the tool.


A little bit of both.  It should be feasible to scan the model looking for B's in classes and changing the parameters and return values to whatever you rename B to.  However, it may be overkill to add this feature if the workaround is to have the naming correct before the code generation. :)

Regards.
We must become the change we want to see.
- Ghandi