Documentations on how a UML class diagram generates C++ code?


It’s been 10 years since I used VP and when I did, it was only for small projects and java code generation.
I am interested at coming back to it but I have some questions about the C++ code generation from a class diagram.
Is there a documentation saying how some things is translated into code ?
For example if I say that Class A is composed of exactly 2 Class B and I generate the code there is no Class B attribute in Class A.

I’m not sure what to except from the generation and I will make mistakes with the class diagram that’s why I would like to know if there is someplace where I can find how VP will generate the code.

Thanks for the help

Hi rXp,

Thank you for your continued support. Sorry that we do not have any documentation that describes the mapping between the class model and generated code. Regarding your case, we have tried but are unable to reproduce the problem. I am attaching my diagram and the outcome for you as a reference. Could you provide us with more information? Thank you!

Best regards,
Jick Yeung

class-diagram instant-generate-cpp-preview

I’m sorry I should have said that I used a composition association to do that.

Maybe I am misinterpreting the UML class diagram but with that diagram I think that A should have 2 Bs that cannot be in multiple As.

Hi rXp,

You have to define the role name in order to generate the attribute name.

Oh thank you that was dumb of me. It uses the role name to define the attribute/member name, I wasn’t aware of that.
Thank you a lot :sweat_smile: