Topic
3 replies Latest Post - ‏2013-01-09T15:25:17Z by SystemAdmin
SystemAdmin
SystemAdmin
1305 Posts
ACCEPTED ANSWER

Pinned topic How to create object of structure type?

‏2013-01-08T14:56:43Z |
Hello

I created a structure in Rhapsody 7.6.2 by creating a "type" with "kind" as "structure". Lets call this structure ABC_t.
So now i want to create an object called XYZ of type ABC_t.
However when I create an object I cannot assign it the type ABC_t.
How do i do that?
Updated on 2013-01-09T15:25:17Z at 2013-01-09T15:25:17Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    1305 Posts
    ACCEPTED ANSWER

    Re: How to create object of structure type?

    ‏2013-01-08T15:43:13Z  in response to SystemAdmin
    I think it is not possible. I wonder why you would want to do it. A structure can only define variables, but an object also contains functions. For me the right way to define the type of an object is to define a class for it.
  • fordP
    fordP
    6 Posts
    ACCEPTED ANSWER

    Re: How to create object of structure type?

    ‏2013-01-09T07:28:12Z  in response to SystemAdmin
    Hello RJadhav,

    are you aware of property "CPP_CG::Class::GenClassAsStruct". Maybe this will help you.
  • SystemAdmin
    SystemAdmin
    1305 Posts
    ACCEPTED ANSWER

    Re: How to create object of structure type?

    ‏2013-01-09T15:25:17Z  in response to SystemAdmin
    Thanks LookItsMe and fordP.
    Using class worked. It is implemented as a structure in Rhapsody in C.

    But i still wonder, why have they given a choice to make a structure typedef in Rhapsody in C when Class is anyways implemented as struct. :-)

    Thanks!