![]() |
Telelogic Rhapsody (steve huntington) | ![]() |
Topic Title: Initialization of object attributes Topic Summary: Created On: 26-Oct-2006 10:49 Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hi,
I am using Rhapsody 7.0MR1 for C++. 1. Define e.g. a class A with an attribute "int x" 2. Define an object a:A 3. Specify in the attributes-tab of the object-features not only an initial value for x (e.g. 0, class relevant), but also a "value" (e.g. 42, only for the object a). The initialization of a.x with 42 is not generated in the code anywhere ! a.x always contains the initial value or - if omitted - anything (from the heap). Is it a bug or do I have set some properties to get the value-assignment generated ? Thanks in advance, Stefan |
|
![]() |
|
![]() |
|
Are you sure? cuz it always generates the code for me. The code will be generated in the class.cpp file, in the format
ClassA::ClassA() : x(0) { } The location of that code can be changed by flipping the preference option CPP_CG::Attribute::InitializationStyle from ByInitializer to ByAssignment. Then you'll get the code ClassA::ClassA { x = 0; } You are setting the "Initial Value" field in the attribute right? |
|
![]() |
|
![]() |
|
Hi Jan,
what you have described is the initial value for a member of the class if instanciated and this works well - as you wrote ;-) But if you have an object (e.g. take class an say 'make an object'), you will see an additional column called 'value' (beneath the 'initial value' column) in the object features (tab attributes). If you enter values for the particular object here, it has no effect at all although it is described different in the manual. Best regards, Stefan |
|
![]() |
|
![]() |
|
I have noticed this same behavior...has there been any resolution?
|
|
![]() |
Telelogic Rhapsody
» Rhapsody Category » Rhapsody
»
Initialization of object attributes
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.