constructors in DRAKON will not accept initialization using colon notation
ACJA opened this issue · 0 comments
Looks like there is no way to implement in DRAKON that fancy entity initialization right after the constructor/method declaration using a colon after the declaration and a list with parameters to be initialized. DRAKON will allow the initialization of various entities only in the body of the constructor or in the DRAKON file description.
Moving the offending initializations section in the body of the constructor/method is not always working because it will be a "later time" initialization, after the derived object and all base components were already created with wrong values. If the entities of interest are "private" it will be impossible to change them now. The single working option is to avoid using DRAKON diagrams for this kind of initializations and place the C++ code into the file description section.
It will be very useful to allow the use of colon notation for initializing various entities in DRAKON diagrams, something like this:
public ctr : C_Horse(EO_aColor, TO_height),
C_Bird(EO_aColor, B_migrates),
VA_itsNumberBelievers(V_NumBelieve)
Instead of being forced to move all the constructor stuff from the diagram to file properties like this:
=== class ===
class C_Pegasus :public C_Horse, public C_Bird {
private:
long VA_itsNumberBelievers;
public:
/// this is the right way to initialize members inherited from the base class when the derived class
/// is created since RAKON diagram will not accept initializations with colon notion
C_Pegasus(E_COLOR EO_aColor, T_HANDS TO_height, bool B_migrates, long V_NumBelieve):
C_Horse(EO_aColor, TO_height),
C_Bird(EO_aColor, B_migrates),
VA_itsNumberBelievers(V_NumBelieve)
{ std::cout << std::endl << "default C_Pegasus :public C_Horse constructor called ... " << std::endl;
V_Number_Of_Objects_Constructed++;
std::cout << "... default C_Pegasus :public C_Horse constructor tasks finished" << std::endl;
}