You are on page 1of 30

Objectives

At the end of the lesson the students are


expected to:
a. Identify inheritance
b. Use a user-defined aggregation in a
class
c. Appreciate the use of a class in
inheritance
Review:
What is encapsulation?

From your assignment, what you have


realized/noticed in the code of
encapsulation?
Activity
Face Combi
Steps:
1. Teacher will randomly pick a picture
2. Using a Face Combi app, combine two
pictures.
3. Find out what is the output and what
part of the face is dominant
Inheritance is the ability to define
classes that serve as the basis for
derived classes. The newly created class
may contain the properties, attributes,
methods, or events of the base class, as
well as define additional properties,
attributes and methods
Inheritance allows reuse of code
functionality, simplify the creation and
maintenance of an application, and speed up
the implementation process

For example, you can create a new class


named “Square” based on the “shape” class.
The “Square” class may inherit the “Color”
property from the “Shape”class and can
have add-on attributes or properties such as
“texture.”
Rather than writing or changing completely
the new data member of a class, the
programmer can create a class by
inheriting the members of an existing class.
The existing class is called the base class,
while the new class is referred to as the
derived class.
Class. A class represents a relevant
concept from the domain, a set of
persons, objects, or ideas that are
depicted in the IT system: ...
Class diagram components
Attribute. ...
Generalization. ...
Association. ...
Multiplicity. ...
Aggregation.
Class Diagram
Class
A class represents a relevant concept from the
domain, a set of persons, objects, or ideas that are
depicted in the IT system:

Examples of classes are passengers, planes, or tickets.


Attribute

An attribute of a class represents a characteristic of a class that is of interest for the user of the IT system:

Characteristics of interest of a passenger, for example, are name and age.


Generalization

Generalization is a relationship between two classes: a general class and a special class:

Refer to Generalization, Specialization, and Inheritance


Association

An association represents a relationship between two classes:

An association indicates that objects of one class have a relationship with objects of another class, in which this
connection has a specifically defined meaning (for example, "is flown with").
Multiplicity

A multiplicity allows for statements about the number of objects that are involved in an association:
Aggregation

An aggregation is a special case of an association (see above) meaning "consists of":

The diamond documents this meaning; a caption is unnecessary.


A. Practice
F. Application
Assessment

___1. Represents a relevant concept from the domain, a set of persons, objects, or ideas that are depicted in the IT
system: ...
___2. Is the ability to define classes that serve as the basis for derived classes. The newly created class
may contain the properties, attributes, methods, or events of the base class, as well as define additional
properties, attributes and methods.
___3. What is the existing class?
___4. What is the new class?
___5. Is a special case of an association meaning "consists of":
Assignment

You might also like