UML class diagram: attribute or association?

Now I have two classes, called the patient and the doctor:

Patient() {
     public:
        //functions here
    private:
    Doctor doctor;
    Date dateAdmitted;
    Date dateDischarged;
}

Doctor() {
    public:
    //functions here
    private:
    //data members here
}

In my UML class diagram for patient class, do I need to include the doctor and date as an attribute? or am I just representing them, linking them as an association?

If the attribute should look like this:

A patient

doctor: doctor

dateAdmitted: Date

dateDischarged: Date

+4
source share
2 answers

UML : ( ) , . , , .. . UML.

, , :

  • (int, boolean, date ..) → show ,
  • class → .

, "int", "boolean" "date" , (inoult ). , , (, , ..) "" .

: , ( , End). Patient:

enter image description here

, , ( atts, ), :

enter image description here

( )

enter image description here

: , Whole-Part , . (Patient-Doctor) , (, -).

+6

UML . .

, , , . Java .

0

Source: https://habr.com/ru/post/1537826/


All Articles