C++ Group 1 Assignment
C++ Group 1 Assignment
It is important for OOP programming for UML is a modeling language used to model
software and non-software systems. Although UML is used for non-software systems, the
emphasis is on modeling OO software applications. Most of the UML diagrams discussed
so far are used to model different aspects such as static, dynamic, etc. Now whatever be
the aspect, the artifacts are nothing but objects
UML precisely conveys how code should be implemented from diagrams. If precisely
interpreted, the implemented code will correctly reflect the intent of the designer. A class may
be involved in one or more relationships with other classes. A relationship can be one of the
following types:
Inheritance (or Generalization):
The figure below shows an inheritance example with two styles. Although the connectors are
drawn differently, they are semantically equivalent.
Association
Associations are relationships between classes in a UML Class Diagram. They are represented
by a solid line between classes. Associations are typically named using a verb or verb phrase
which reflects the real world problem domain.
Simple Association
A structural link between two peer classes.
There is an association between Class1 and Class2
The figure below shows an example of simple association. There is an association that
connects the <<control>> class Class1 and <<boundary>> class Class2. The relationship is
displayed as a solid line connecting the two classes.
Cardinality
Aggregation
Composition
A special type of aggregation where parts are destroyed when the whole is destroyed.
Objects of Class2 live and die with Class1.
Class2 cannot stand by itself.
The figure below shows an example of composition. The relationship is displayed as a solid
line with a filled diamond at the association end, which is connected to the class that represents
the whole or composite.
Dependency
An object of one class might use an object of another class in the code of a method. If the
object is not stored in any field, then this is modelled as a dependency relationship.
A special type of association.
Exists between two classes if changes to the definition of one may cause changes to the
other (but not the other way around).
Class1 depends on Class2
The figure below shows an example of dependency. The relationship is displayed as a dashed
line with an open arrow.
The figure below shows another example of dependency. The Person class might have a
hasRead method with a Book parameter that returns true if the person has read the book
(perhaps by checking some database).
Realization
Realization is a relationship between the blueprint class and the object containing its respective
implementation level details. This object is said to realize the blueprint class. In other words,
you can understand this as the relationship between the interface and the implementing class.
For example, the Owner interface might specify methods for acquiring property and disposing
of property. The Person and Corporation classes need to implement these methods, possibly in
very different ways.