Re: How to represent a constructor in UML?
On Aug 19, 5:25 am, "rcdai...@gmail.com" <rcdai...@gmail.com> wrote:
On Aug 18, 5:16 pm, "mrdoommas...@gmail.com" <rcdai...@gmail.com>
wrote:
Hi,
How do I represent a constructor in UML?
Say I have a class named Foo. Would it look like so:
+Foo( some_val : int )
Is the above correct? Thanks for reading.
That's the way I normally do it.
One more thing... How do I represent const parameter values? For
example:
void Bar( const std::string& file );
In UML, would this be:
+Bar( file : const std::string& )
Is the above correct? Thanks for your help.
I think you could do it that way. Normally I would do this:
~Bar( file : std::string )
You are logically passing a string (as copy), but the const reference
is an (implementation) optimisation to avoid copying the string. I
don't see it as part of the logical type for the member.
We use UML for C++ code generation, but the UML design sits at the
level of the object model above where the C++ is. There is an example
of the sort of UML design we use here:
http://www.kirit.com/Netflix%20Prize/Design/Static%20data/Class%20diagram
The diagram shows the highest level object model which produces
artefacts that can be interacted with through SQL, C++ and COM and
HTTP (via HTML).
K