Author Topic: Invoking a Base Class Constructor in C++  (Read 2819 times)

Zidane

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Invoking a Base Class Constructor in C++
« on: November 09, 2006, 09:04:37 am »
If I manually change a constructor to invoke a constructor of the base class, this info is deleted with the next code generation / synchronisation loop.

Example:

GENERATED HEADER FILES
===================

class A
{
A(int x);
}

class B : private A
{
B(int x);
}

GENERATED CPP FILES
================

A::A(int x){}
B::B(int x){}

================

Now I change last line manually to
---------------------
B::B(int x):A(x){}
---------------------
which would be okay,
but after next synchronization this change is lost.

Any idea?!?

Best regards,
DD.



Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8061
  • Karma: +118/-20
    • View Profile
Re: Invoking a Base Class Constructor in C++
« Reply #1 on: November 09, 2006, 12:59:52 pm »
EA is removing the inialization list because it expects to it to be defined in a tagged value "initializer" on the constructor.  If you add this tagged value then things should work as expected.

For more information on how C++ is modelled in EA please see http://www.sparxsystems.com.au/EAUserGuide/index.html?cpp_conventions.htm

Zidane

  • EA User
  • **
  • Posts: 29
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Invoking a Base Class Constructor in C++
« Reply #2 on: November 17, 2006, 02:16:45 pm »
Forgot to say: Thank you  ;D