Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Zidane on November 09, 2006, 09:04:37 am

Title: Invoking a Base Class Constructor in C++
Post by: Zidane 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.


Title: Re: Invoking a Base Class Constructor in C++
Post by: Eve 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
Title: Re: Invoking a Base Class Constructor in C++
Post by: Zidane on November 17, 2006, 02:16:45 pm
Forgot to say: Thank you  ;D