Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » How to specify C++ member initialzers in Papyrus?
How to specify C++ member initialzers in Papyrus? [message #1807014] Tue, 21 May 2019 09:56 Go to next message
Martin Friedrich is currently offline Martin FriedrichFriend
Messages: 7
Registered: November 2015
Junior Member
Hi all,

how does one specify member initializers for a class' members in Papyrus, i.e. to end up with
class Foo  {
    int mValue;
   Foo();
};

Foo :: Foo() :
     mValue( 0 ) // <-- member initializer
{
}

what does cause Foo's constructor to call the member initializer? On a similar subject, how cause generating a base class initializer?

Thanks,

Martin Friedrich
Re: How to specify C++ member initialzers in Papyrus? [message #1807028 is a reply to message #1807014] Tue, 21 May 2019 12:06 Go to previous messageGo to next message
Yoann Farre is currently offline Yoann FarreFriend
Messages: 116
Registered: November 2017
Senior Member
Hello,

You can apply the stereotype "ConstInit" (of the C_Cpp profile) on your constructor (Operation which has the stereotype "Create"). In the field "initialisation" you can type your member initializer. With your example : mValue(0)

Regards.

Yoann Farré
Re: How to specify C++ member initialzers in Papyrus? [message #1807086 is a reply to message #1807028] Wed, 22 May 2019 11:25 Go to previous messageGo to next message
Martin Friedrich is currently offline Martin FriedrichFriend
Messages: 7
Registered: November 2015
Junior Member
Thanks for input, Yoann, this solved my problem.

In fact, I noticed this stereotype before, but its name led me to believe it was intended to used to specify const member initializations located in the classes' declaration.

Bye,

Martin Friedrich
Re: How to specify C++ member initialzers in Papyrus? [message #1807094 is a reply to message #1807086] Wed, 22 May 2019 13:18 Go to previous message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 228
Registered: March 2011
Location: Paris Saclay, France
Senior Member
I've updated the documentation on the wiki page. This stereotype (as well as create/destroy) was missing in the table explaining the stereotypes of the C++ profile.
Previous Topic:copy classes from one model to another
Next Topic:Qualified Associations
Goto Forum:
  


Current Time: Mon Dec 16 02:15:18 GMT 2019

Powered by FUDForum. Page generated in 0.03198 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top