Take the 2-minute tour ×

I have two private data structures and five functions in my class, How can I represent the relation between the functions and the data structures in class. Eg: Two of those functions uses the First data structure and three other functions uses the second data structure.

Also How can I represent relation between the functions in the class. eg : among the 5 functions two are public and three are private, one public function in the class calls the other three private functions.

If this is not relevant in class diagram then what is the best solution to represent this in UML.

share|improve this question

2 Answers 2

the interaction of functions and fields is not displayed in a Class Diagram.

Therefore you should use a sequence diagramm. But normaly you do not show the interaction of fields within an Object. You display the interaction on the level of function calls between Objects.

share|improve this answer
Thank your answer. I have to represent the field - function relations and function - function relations. this is for a module in C not C++ object. I'm looking for a method for representing design details of C module in detail using UML. In sequence diagram I can show the interaction between the objects, but how can I represent the details within a object. –  James Joy Jul 25 '12 at 6:15

Two things. First, there's a good reason UML doesn't provide notation for depicting relationships & structure within a class. Classes are supposed to be cohesive abstractions of data and function. So if you have any significant structure within a class, you should question whether it should be split into 2 (or more) cohesively abstracted classes.

OK. So that's the backdrop. From your description, how about:

  • Draw one class for each data structure with one attribute for each structure member
  • Add a method to each class for each function that operates on the data structure
  • Add an association between the classes that captures their relationship
  • Place all the bits above in a package to represent the module

The final point - as in all these things - is to use the tool to illustrate what you want. Don't be overly constrained by the rules of the modelling language. The important thing is that the diagram communicates effectively to you & your collaborators. Satisfying the 'language lawyers' should be much less of a consideration.


share|improve this answer

Your Answer


