views:

1042

answers:

1

What would be the best strategies to describe the following:

1) class A created instances of classes B and C 2) class B being able to communicate to class D through a pointer in class B to a specific member in class D

Thanks in advance for the suggestions, as I don't know the proper term to describe them in order to search for more information on the internet.

+1  A: 

There's a type of diagram called a "data flow diagram", but that's not one of the UML diagrams.

Showing that A creates instances of B and C can be shown in a UML 'sequence diagram', which shows the sequence in time at which things happen (e.g. an instance of A exists at time T0, at time T1 it creates an instance of B, and at time T2 it creates an instance of C).

Showing that B has a member which points to D can be shown in a UML 'class diagram', which illustrates the members (methods and instance data) of a class or classes.

However I don't think UML has a notation for "pointer to member" ... and I'm not sure what you mean when you say that "B communicates to class D through a pointer to a specific member in D": can you please give an example (e.g. in source code) to illustrate that?

ChrisW
For example, in constructor of class D (I'm not sure how to format it so that the source code stands out) and similarly for class B:D(){ Application *App = (Application*) AfxGetApp(); App->D = this;}Then in one of class B's methodsvoid B::Method(){ Application *App = (Application*) AfxGetApp(); DoOperation(App->D.point);}
stanigator
Just a class diagram then: the pointer in B doesn't point to a (specific) member of D, instead it points to an (entire) instance of D.
ChrisW