Book a Demo

Author Topic: How to model C struct and initializers?  (Read 2079 times)

ssinnige

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
How to model C struct and initializers?
« on: November 20, 2005, 09:14:51 pm »
Hi,

I wish to model a C structure (or C++ class for that matter) with an object that uses an initialiser list. For example:

struct A
{
       int member1;
       int member2;
};
struct A a = {10, 20};

I can model the struct easily by defining a class A with stereotype <<struct>>. I have problems to model an instance of this struct. First I thought to create an instance of the class and name it "a", but I can't get the initialising list in the model.

Also, when I generate code from the model, I can only generate code for the structure itslef, not the object.

I guess I'm not the first one doing something like this. How did you solve this?

Stefan.