Class and Object Diagrams: Dr.A.Ashok Kumar Department of Computer Science Alagappa Government Arts College Karaikudi
Class and Object Diagrams: Dr.A.Ashok Kumar Department of Computer Science Alagappa Government Arts College Karaikudi
Dr.A.Ashok Kumar
Department Of Computer Science
Alagappa Government Arts College
Karaikudi
• The visibility symbols appearing in a UML class
diagram correspond to the C++ keywords:
– "-" → "private:"
– "+" → "public:"
– "#" → "protected:"
UML Modeling Class Equivalent C++ code
diagram
class Time
{
private:
int hours;
int minutes;
int seconds;
public:
Time();
Time(int h, int m, int s);
Time(int s);
Time add(Time t2);
Time* add(Time* t2);
void print();
void read();
};
• Object Diagrams use real world examples to depict the nature and structure
of the system at a particular point in time
• Object diagrams provide a clearer view of the relationships that
exist between objects
• The object diagram should have a meaningful name to indicate its purpose