Book a Demo

Author Topic: How to model lists of class instances?  (Read 2142 times)

wink

  • EA User
  • **
  • Posts: 48
  • Karma: +0/-0
  • Montjoie, que jamais ne choit!
    • View Profile
How to model lists of class instances?
« on: May 19, 2005, 08:33:48 am »
Hello everybody,

I'd need some help please!

I have to model the following situation in UML for C++:
(Note that I can't use C++ templates because of an embedded environment!)

Class "List" // this class is a list of any type of object.
Class "Word"  // this class contains a simple text word
Class "Phrase" // this class instanciates and maintains a list of instances of "Word"

Typically, "Phrase" would instanciate "List", read a file and create an object of "Word" for each word in the file and add it to the list.
Then "Phrase" might iterate through the list to display each word.

Obviously there are relations between all three classes but I really don't know how to model this in UML so that it reflects the C++ code. Could somebody please give me some hints?

Many thanks in advance and have a nice day,
Best regards,
Manfred