Book a Demo

Author Topic: Generated Constructor Includes Return Type  (Read 3898 times)

avexus_kms

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
  • I love YaBB 1 Gold!
    • View Profile
Generated Constructor Includes Return Type
« 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?

Tjerk

  • EA User
  • **
  • Posts: 231
  • Karma: +1/-0
    • View Profile
Re: Generated Constructor Includes Return Type
« Reply #1 on: January 15, 2003, 11:56:21 pm »
Hi Avexus,

The const stands for Constant, not constructor, the operation is then a constant operation.

Greetings,
Tjerk

avexus_kms

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
  • I love YaBB 1 Gold!
    • View Profile
Re: Generated Constructor Includes Return Type
« Reply #2 on: January 16, 2003, 07:55:39 am »
OK, thanks. So how do I include a constructor in my design?

Tjerk

  • EA User
  • **
  • Posts: 231
  • Karma: +1/-0
    • View Profile
Re: Generated Constructor Includes Return Type
« Reply #3 on: January 16, 2003, 11:27:01 pm »
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

dknox

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: Generated Constructor Includes Return Type
« Reply #4 on: February 01, 2003, 03:23:04 pm »
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