Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: avexus_kms on January 15, 2003, 11:23:43 am
-
When creating an operation on one of my classes, I checked the "Const" checkbox on the "General" tab. I assumed that meant that this operation would be a constructor. When I generated the class, however, the generated code included a return type of "void". This is incorrect syntax for a constructor which, of course, has no return type.
Was I incorrect in assuming that the "Const" checkbox indicated that I wanted this operation to be considered a constructor?
Or is there a bug in EA that is causing it to add a return type to constructors?
-
Hi Avexus,
The const stands for Constant, not constructor, the operation is then a constant operation.
Greetings,
Tjerk
-
OK, thanks. So how do I include a constructor in my design?
-
1. Try menu View/Options.../Generation/Object Lifetimes.
Or, per class,
2. Press Ctrl-G when class is selected, Advanced.
BUG: when I generated a class with a constructur, settings to synchronise and the generate the class with a constructor and a destructor, the destructor is not generated (done using the second method above).
Tjerk
-
Hi,
Don't know what lanaguage you are generating. I tend to generate mostly Java. The Advanced settings mentioned by allow you to generate a default constructor. I've found the same thing that you did with parameterized constructors. I would always have to remember to delete the "void" in the return type before I saved the operation. If I remembered to do that then the constructor would be generated correctly. The problem with 'void' returning if the operation was edited again seems to have been fixed in the 3.51_600 build.
-- dave