Thread: UML question

  1. #1
    Seeking motivation... endo's Avatar
    Join Date
    May 2002
    Posts
    537

    UML question

    How do I represent an enumeration in UML, specifically using rational Rose?

    tia

  2. #2
    Registered User Strider's Avatar
    Join Date
    Aug 2001
    Posts
    149
    I believe that it would look something similar to this:

    Code:
     __________________________________________
    |              SampleClass                 |
    |__________________________________________|
    |                                          |
    | +sampleEnum : SampleEnum = Yes {Yes, No} |
    |__________________________________________|
    |__________________________________________|
    The property-list being {Yes, No}.

    David
    Last edited by Strider; 07-02-2002 at 12:53 PM.
    One Ring to rule them all, One Ring to find them,
    One Ring to bring them all and in the darkness bind them
    In the Land of Mordor where the Shadows lie.

  3. #3
    Seeking motivation... endo's Avatar
    Join Date
    May 2002
    Posts
    537
    So that would be equivalent to:
    Code:
    enum SampleEnum
    {
       yes,
       no
    };
    would it? And defined as a member of a class? At the moment I have this (see below) but I'm not sure how it fits together in UML (my book uses Java )
    Code:
    enum SEX
    {
       MALE,
       FEMALE
    };
    
    class Student
    {
    public:
       //stuff
    private:
       //some data members +
       SEX sex;
    };
    thx for the help, much appreciated
    Last edited by endo; 07-03-2002 at 03:50 PM.

  4. #4
    TK
    Guest
    Just make sure that you can tell that the data type is enum but listing all the enumerations is a good ideas if they will fit. You could also attach a note icon.

  5. #5
    Registered User Strider's Avatar
    Join Date
    Aug 2001
    Posts
    149
    The format is as follows:

    <name> : <type> = <default> {<parameter list, ...>}

    so...
    Code:
    enum SEX
    {
       MALE,
       FEMALE
    };
    
    class Student
    {
    public:
       //stuff
    private:
       //some data members +
       SEX sex;
    };
    would look similar to this:
    Code:
     __________________________________
    |             Student              |
    |__________________________________|
    |                                  |
    | +sex : SEX = MALE {MALE, FEMALE} |
    |__________________________________|
    |__________________________________|
    David
    One Ring to rule them all, One Ring to find them,
    One Ring to bring them all and in the darkness bind them
    In the Land of Mordor where the Shadows lie.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Debugging question
    By o_0 in forum C Programming
    Replies: 9
    Last Post: 10-10-2004, 05:51 PM
  2. Question about pointers #2
    By maxhavoc in forum C++ Programming
    Replies: 28
    Last Post: 06-21-2004, 12:52 PM
  3. Question...
    By TechWins in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 07-28-2003, 09:47 PM
  4. Question about linked lists.
    By cheeisme123 in forum C++ Programming
    Replies: 6
    Last Post: 02-25-2003, 01:36 PM
  5. Question, question!
    By oskilian in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 12-24-2001, 01:47 AM