Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constructors in DRAKON will not accept initialization using colon notation #9

Open
ACJA opened this issue Mar 28, 2016 · 0 comments
Open

Comments

@ACJA
Copy link

ACJA commented Mar 28, 2016

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;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant