Author Topic: How to model constructor?  (Read 3574 times)

blackpuppy

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-0
    • View Profile
How to model constructor?
« on: March 30, 2005, 06:43:31 pm »
Is it possible to model the constructor as a class operation?  Or there is a specific way to do that?

I want to show the constructor in the communication diagram.  I first define an operation named "new".  But later found it will be generated as a method named "new" in the code and this is not waht I want.  So later I use the class name as the operation name and set the return value blank.  I was afraid that the code template will generate a default constructor and another constructor for my operation.  But it turns out that the code template will check and avoid generating two constructors of the same name.

How does other people model constructors?  What is the recommended way?

Thanks!
Best regards!
Zhu Ming

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Re: How to model constructor?
« Reply #1 on: March 30, 2005, 09:35:17 pm »
For C# I do it exactly the way you have described - except I always manually stereotype them as <<ctor>>.


hth
Bruce
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.