Book a Demo

Author Topic: C++: const parameters; inlines; friends...  (Read 2798 times)

Karsten Meier

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
C++: const parameters; inlines; friends...
« on: November 16, 2007, 12:16:39 am »
Hi EA-Experts,

I'm rather new to EA. While playing around with C++ - generating and reverse generating I discovered some points and questions:

1) If I design a method with a const-parameter this method will be generated new each time the class is generated. The result is that the method appears <generating times> times in the header and implementation file !?

i.e. (in the model):
class A {
public:
  void test(const int myParam);
};

Generate it three times the resulting code looks like:
class A {
public:
  void test(const int myParam);
  void test(const int myParam);
  void test(const int myParam);
};

2) The Synchronize/Generate mechnism dont know that
int test(); and int test(void); are the same which results in duplicate entries in the code-files and the model

3) Where/how are friend-Relationships are modelled?

4) The keyword "inline" seems to be reported as an error during "import C++ files". I saw it once when I tried to import the STL-string class - the "string"-header (without ".h"!). The error was in that line:
"template<class _E, class _Tr, class _A> inline"
( it is followed by an operator+ definition for basic_string)

@EDIT ->@
5) Just a funny thing: It is possible to let EA generate a setter-method for a const-attribute :-)
@<- EDIT@

@EDIT(2) ->@
6) If I configure an initial value for an attribute this initial value dont seems to be generated?
@EDIT(2) <-@

Perhaps someone may be able to answer one or more of these points. Thanks in advance.

regards,
Karsten


« Last Edit: November 16, 2007, 12:23:28 am by dox »

Karsten Meier

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: C++: const parameters; inlines; friends...
« Reply #1 on: November 16, 2007, 12:47:31 am »
Hi again,

I solved (1):
I didnt use the "fixed" checkbox, but typed in "const int" as the parameter type.

regards,
Karsten

gpc

  • EA User
  • **
  • Posts: 111
  • Karma: +0/-0
    • View Profile
Re: C++: const parameters; inlines; friends...
« Reply #2 on: November 16, 2007, 05:41:36 am »
(2) Isn't int test() the same as int test(int) ?
If you want it to be void, you need to specify.