0% found this document useful (0 votes)
93 views7 pages

C++ Group 1 Assignment

UML notation is a graphical language used to visualize and document software systems using diagrams. Class diagrams specifically show the objects, attributes, operations, and relationships between classes in an object-oriented system. The main relationships are inheritance, association, aggregation, and composition. These relationships are represented using lines and arrows between classes. Access modifiers like public, private, and protected are denoted with symbols like +, -, and #.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views7 pages

C++ Group 1 Assignment

UML notation is a graphical language used to visualize and document software systems using diagrams. Class diagrams specifically show the objects, attributes, operations, and relationships between classes in an object-oriented system. The main relationships are inheritance, association, aggregation, and composition. These relationships are represented using lines and arrows between classes. Access modifiers like public, private, and protected are denoted with symbols like +, -, and #.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

1.

What is UML notation and why is it important for oop programming

This is a graphical language for visualizing, specifying, constructing, and documenting


the artifacts of a software-intensive system. The UML offers a standard way to write a
system’s blueprints, including conceptual things such as business processes and system
functions as well as concrete things such as programming language statements, database
schemas, and reusable software components.

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

2. What is a class diagrams


These are the main building block in object-oriented modeling. They are used to show the
different objects in a system, their attributes, their operations and the relationships among them.
And or Class diagram shows the building blocks of any object-orientated system. Class diagrams
depict a static view of the model, or part of the model, describing what attributes and behavior it
has rather than detailing the methods for achieving operations. Class diagrams are most useful in
illustrating relationships between classes and interfaces. Generalizations, aggregations, and
associations are all valuable in reflecting inheritance, composition or usage, and connections
respectively
3. What are the relationship we find in class diagrams?
Relationships shows how the elements are associated with each other and this association
describes the functionality of an application.

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):

A generalization is a taxonomic relationship between a more general classifier and a more


specific classifier. Each instance of the specific classifier is also an indirect instance of the
general classifier. Thus, the specific classifier inherits the features of the more general
classifier.
 Represents an "is-a" relationship.
 An abstract class name is shown in italics.
 SubClass1 and SubClass2 are specializations of SuperClass.
The figure below shows an example of inheritance hierarchy. SubClass1 and SubClass2 are
derived from SuperClass. The relationship is displayed as a solid line with a hollow arrowhead
that points from the child element to the parent element.

Inheritance Example - Shapes

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

Cardinality is expressed in terms of:


 one to one
 one to many
 many to many

Aggregation

A special type of association.


 It represents a "part of" relationship.
 Class2 is part of Class1.
 Many instances (denoted by the *) of Class2 can be associated with Class1.
 Objects of Class1 and Class2 have separate lifetimes.
The figure below shows an example of aggregation. The relationship is displayed as a solid
line with a unfilled diamond at the association end, which is connected to the class that
represents the aggregate.

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.

4. What notations are used to represent the relation?


5. How do you represent protected, public and private data members and member
functions?
 Public − A public member is visible from anywhere in the system. In class diagram, it is
prefixed by the symbol ‘+’.
 Private − A private member is visible only from within the class. It cannot be accessed
from outside the class. A private member is prefixed by the symbol ‘−’.
 Protected − A protected member is visible from within the class and from the subclasses
inherited from this class, but not from outside. It is prefixed by the symbol ‘#’.
Example − Let us consider a Circle class. The attributes of Circle are x-coord, y-coord, and
radius. The operations are findArea(), findCircumference(), and scale(). Let us assume that x-
coord and y-coord are private data members, radius is a protected data member, and the member
functions are public. The following figure gives the diagrammatic representation of the class.

You might also like