Advanced Programming
-
Upload
chastity-dominguez -
Category
Documents
-
view
13 -
download
3
description
Transcript of Advanced Programming
Adva
nced
Pro
gram
ing
TA S
essi
on,
Shar
if U
nive
rsity
of T
echn
olog
y
Advanced ProgrammingTA Session 5
1
Adva
nced
Pro
gram
ing
TA S
essi
on,
Shar
if U
nive
rsity
of T
echn
olog
y
2
Adva
nced
Pro
gram
ing
TA S
essi
on,
Shar
if U
nive
rsity
of T
echn
olog
y
3
Adva
nced
Pro
gram
ing
TA S
essi
on,
Shar
if U
nive
rsity
of T
echn
olog
y
4
Adva
nced
Pro
gram
ing
TA S
essi
on,
Shar
if U
nive
rsity
of T
echn
olog
y
5
Adva
nced
Pro
gram
ing
TA S
essi
on,
Shar
if U
nive
rsity
of T
echn
olog
y
6
Adva
nced
Pro
gram
ing
TA S
essi
on,
Shar
if U
nive
rsity
of T
echn
olog
y
7
Adva
nced
Pro
gram
ing
TA S
essi
on,
Shar
if U
nive
rsity
of T
echn
olog
y
8
Adva
nced
Pro
gram
ing
TA S
essi
on,
Shar
if U
nive
rsity
of T
echn
olog
y
9
Adva
nced
Pro
gram
ing
TA S
essi
on,
Shar
if U
nive
rsity
of T
echn
olog
y
10
Adva
nced
Pro
gram
ing
TA S
essi
on,
Shar
if U
nive
rsity
of T
echn
olog
y
11
1. Y{¼¿� .{ ʻY mYd ̬§Â»Z] ËÄ»Z¿ ]Ä «ºÌ¿Y{Ê»� � � � � �UML Class Diagram¾ËYÁ| ÌÀÊuY ZÅ Ô ¾ËYÉY ]Y� � � � �( .| ÌÀÉ ZÃ{ZÌa¶»Zc  Ä]Y ÊuY� � � � � � �25)ü¿�
Y®Ë Å¥~uc  {� � � � � :t Ì Âe�Cast®ËZÅSyntax error,| ¾ËY {� .d Y{ºÌÅYÂy�Namable®ËinterfaceÁ
PersonY{¼¿º {� � � � .d Y Ô ®Ë� �UMLÁZÅ Ô ¹Z¿ },� �interfaceÊËZÅ YÁÁZÅ Ô mÄ]� � � � .d ̧ZZÅ� .| Ì ËÂÀ]|ËZ]Y ZÅ YÁÁZÅ Ô Ä¼ÅÄ] Â] »| ¯� � � � � � � .| ÌÀ°¿Ä§Z YY É ´Ë{ YÁZË Ô ,d YÃ|»M Ë| ¯ {Ä� � � � � � � � � �
Namable lionelMessi = new FootballPlayer("Lionel Messi", 242000); System.out.println(lionelMessi.getName()); Person person = (Person) lionelMessi; System.out.println(person.getName()); HasPrice hp1 = (HasPrice) lionelMessi; HasPrice hp2 = new Book("Hafez Poems", 10); System.out.println((hp1.getPrice()>hp2.getPrice())); Namable b = (Namable)hp2; System.out.println(b.getName());
Adva
nced
Pro
gram
ing
TA S
essi
on,
Shar
if U
nive
rsity
of T
echn
olog
y
12