Skip to main content



      Home
Home » Modeling » Papyrus » Class attributes/Function parameters
Class attributes/Function parameters [message #1869072] Wed, 31 July 2024 05:16 Go to next message
Eclipse UserFriend
Hello,

In a class diagram, I created attributes for my classes. Is there a solution to use these attributes as parameters in functions that I created in these classes ?
Re: Class attributes/Function parameters [message #1869120 is a reply to message #1869072] Thu, 01 August 2024 09:01 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

No it is not possible to use attributes as parameter of operation and I don't really understand the goal: attributes are always accessible in the implementation of your operation.

It is possible to use attributes if you declare the behavior of the operation. In this case if you use an activity to describe the behavior you can use ReadSelfAction and ReadStructuralFeatureAction(attr) to do the equivalent of this.attr.

HTH,
Pauline

[Updated on: Thu, 01 August 2024 09:20] by Moderator

Re: Class attributes/Function parameters [message #1869186 is a reply to message #1869120] Sun, 04 August 2024 09:41 Go to previous messageGo to next message
Eclipse UserFriend
You might ask the same question of Java. How do I use the fields of a class as the parameters of a method? You can't; it makes no sense. Rather a method body can contain Java code that has sub-expressions such as "this.myField" to access the myField of the this instance.

Similarly in UML, you may define the body of an operation with OCK and sub-expressions such as "self.myField" to access the myField of the self instance..
Re: Class attributes/Function parameters [message #1869204 is a reply to message #1869186] Mon, 05 August 2024 03:34 Go to previous messageGo to next message
Eclipse UserFriend
Thank you Pauline and Ed for the help.
What do you mean by OCK ?
Re: Class attributes/Function parameters [message #1869210 is a reply to message #1869204] Mon, 05 August 2024 06:01 Go to previous message
Eclipse UserFriend
Most likely OCK is a typo and OCL is the term intended,
Previous Topic:Help to build papyrus
Next Topic:Papyrus 6.7.0 and SysML 1.6?
Goto Forum:
  


Current Time: Tue Nov 04 00:37:56 EST 2025

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

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

Back to the top