Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Class Diagram - Class Constructor
Class Diagram - Class Constructor [message #1791910] Fri, 06 July 2018 18:53 Go to next message
hey you is currently offline hey youFriend
Messages: 15
Registered: July 2018
Junior Member
Dear all I am new to Papyrus and I am struggling to figure out how to create a constructor.
I followed this video: /watch?v=Er2w1pfCycA&list=PLoWne5q-c9E_Q2_eAUZKPDA5K0V-O5zXs&index=7 (youtube) and there is a mention of using stereotypes in order to have a constructor.

I have tried to use stereotypes as mentioned in the video, but none of them are listed once I try to add them (picture attached).

I am using Eclipse Modelling Tools Oxygen.3a Release (4.7.3a)
I attached a screenshot of papyrus installed software.

Thank you in advance.

Best regards.
Re: Class Diagram - Class Constructor [message #1792157 is a reply to message #1791910] Thu, 12 July 2018 08:54 Go to previous messageGo to next message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 228
Registered: March 2011
Location: Paris Saclay, France
Senior Member
Hi,

you need to apply the "Standard" profile which contains the stereotypes "Create" and "Destroy" for constructor and destructor, respectively.
Select the root of your model and choose "apply registered profile".

Ansgar
Re: Class Diagram - Class Constructor [message #1800443 is a reply to message #1792157] Fri, 28 December 2018 14:13 Go to previous messageGo to next message
hey you is currently offline hey youFriend
Messages: 15
Registered: July 2018
Junior Member
Hi Ansgar,

thanks for the help, now it works. However empty constructor is being generated, is it possible to generate inside the constructor code that sets class' fields to the values of constructor's parameters?
Re: Class Diagram - Class Constructor [message #1800475 is a reply to message #1800443] Sat, 29 December 2018 09:27 Go to previous message
Ansgar Radermacher is currently offline Ansgar RadermacherFriend
Messages: 228
Registered: March 2011
Location: Paris Saclay, France
Senior Member
The C++ profile has stereotype called ConstInit. But you need to set the contents manually (default values are initialized in the header file). If you want a constructor body, use the standard way (opaque behavior with C++ as language).
Previous Topic:missing java profile
Next Topic:Connector shall only connect predefined Stereotypes
Goto Forum:
  


Current Time: Mon Dec 16 02:13:50 GMT 2019

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

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

Back to the top