Book a Demo

Author Topic: Base class constructor is removed on re-generation  (Read 3986 times)

Oleg

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Base class constructor is removed on re-generation
« on: April 17, 2008, 01:04:26 am »
Hi,

Is there a way to tell EA to preserve base class constructor call on code generation? Here is the example:

class A { public A(int i){} }

class B : A
{
    B() [highlight]:base(5)[/highlight] {}
}

The [highlight]:base(5)[/highlight] is removed each time I re-generate this class. It's preserved only if I reversed-engineered the class from the source.

Is there a way to preserve the base ctor call without reverse-engineering?

Thanks in advance,
Oleg

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Base class constructor is removed on re-genera
« Reply #1 on: April 17, 2008, 08:36:42 am »
Reverse engineering adds a tagged value "intializer" = "base(5)" (for the example you've given) if you add this tagged value EA will regenerate it.

Oleg

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Base class constructor is removed on re-generation
« Reply #2 on: May 05, 2008, 04:15:01 am »
Thank you, Simon.

Is there a way to preserve any code (like this initializer) without implementing it within EA?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Base class constructor is removed on re-generation
« Reply #3 on: May 05, 2008, 08:38:07 am »
The EA parser matches the initializer as part of the declaration.  The entire declaration is replaced on synchronization (if EA thinks it is necessary).  This is unlikely to change because it would mess up anyone already working that way.

So, if you want to preserve it without adding the information to the model you'll need to avoid EA's code generation feature.

Oleg

  • EA Novice
  • *
  • Posts: 12
  • Karma: +0/-0
    • View Profile
Re: Base class constructor is removed on re-generation
« Reply #4 on: May 05, 2008, 08:40:43 am »
Thank you, Simon, for you promt and comprehencive responce.

Oleg