Presentation is loading. Please wait.

Presentation is loading. Please wait.

Class diagrams Terézia Mézešová.

Similar presentations


Presentation on theme: "Class diagrams Terézia Mézešová."— Presentation transcript:

1 Class diagrams Terézia Mézešová

2 Class diagram static diagram, part of UML describing classes structure of system shows classes, their attributes and methods and relationships between classes classes represent main interactions in system and classes to be programmed

3 Classes name attributes methods abstract classes have name in italics

4 Attribute and method syntax
visibility name : data_type visibility name ( parameter_name : parameter_type, ... ) visibility: +   public -    private #   protected /   derived _   static

5 Relationships class level: generalization realization instance level:
association aggregation composition

6 Generalization "is a" relationship, inheritance
instance of subtype is also instance of superclass

7 Realization one element realizes the behavior of second element
e.g. relationship between classes and interfaces showing that the class realizes methods offered by the interface

8 Association represents static relationship between objects of two classes

9 Aggregation "has a" relationship type of association relationship
can only involve two classes

10 Composition "owns a" relationship stronger than aggregation
if the container class is destroyed, all contained classes must be destroyed as well

11 Other types of relationships
dependency - one class uses another at some point multiplicity: no or one instance 1 - exactly one instance 0..* - zero or more instances 1..* - at least one or more instances

12 Thank you for your attention


Download ppt "Class diagrams Terézia Mézešová."

Similar presentations


Ads by Google