UnknownPay
UnknownPay

Reputation: 13

Class diagram for a class creating another class

If class Admin job is to create another class Lecturer, what relation should i put between them and should GUI include into class diagram

enter image description here

(Image with better resolution: http://postimg.org/image/rxnlbplpz/)

Am i doing this right?

Upvotes: 1

Views: 7459

Answers (2)

xmojmr
xmojmr

Reputation: 8145

The relation you may use is

Source: uml-diagrams.org: Dependency in UML

enter image description here

For one example of it's use in UML class diagram see uml-diagrams.org: Sentinel HASP Classes of Aladdin Package

For an example of object creation message (<<create>>) in UML sequence diagram see uml-diagrams.org: Submit Comments to Pluck

You can mix whatever set of classes coming from whichever package/layer in your UML class diagram (including GUI classes) freely. It is just a matter of taste and matter of what you want to show/emphasize.

Upvotes: 3

Vladimir
Vladimir

Reputation: 2129

You can simply define "dynamic" creation of instance of class using "new" message in sequence diagram. Creation message should be drawn from lifeline representing Admin to lifeline which represent Lecturer. "New" message ends at lifeline header symbol of target (created) instance. For more details see UML Superstructure document section interactions. Similar operation of creation is possible to define in Activity diagram using special action CreateObjectAction. See UML Superstructure Action model section.

Static relation for creation is not standard UML construction.

Upvotes: 0

Related Questions