java


Could you help provide a solution to applying the decorator design pattern to this code? [on hold]


I have an exam coming up and in the one of the past papers this question, comes up i'm hoping someone can help provide a solution.
Thanks.
Question: Describe the decorator design pattern in about three sentences.Then apply the decorator design pattern to the classes below. The aim is to make the class Student a decorator of the class Person. Do not copy the code but describe what changes are needed to use the decorator design pattern.
public class Person
{
private String givenName;
private String familyName;
public Person(String given, String family)
{
givenName = given;
familyName = family;
}
public String getGivenName()
{
return givenName;
}
public String getFamilyName()
{
return familyName;
}
}
public class Student extends Person
{
private int id;
public Student(String given, String family, int id)
{
super(given,family);
this.id = id;
}
public Person getPerson()
{
return new Person(getGivenName(),getFamilyName());
}
}

Related Links

JavaFX Side-Scrolling game: How to generate interactive objects in “extended” scene
GifSequenceWriter Creating White Gif
How to create java arithmetic calculator with recursion [duplicate]
Can someone help me visualize this reverse Linked List recursion?
lambda function not working
Is it possible to have multiple src folders in the same folder in IntelliJ?
Git branch strategy for feature branch model without a develop branch
prompting a user input for both rows and columns in my Checkerboard? (Java Programming)
Spark MLLib LogisticRegression debug model?
Set fixed part size in Eclipse E4
Android - Altering table columns now crashes program. java.lang.NumberFormatException: Invalid int: “T”
If statement errors, Java
Pass integer to thread
Keep asking for number and add and keep a counter and exit if entered letter Q
Putting Strings in Lexicographic Order
Rendering a rectangle with multiple classes

Categories

HOME
reflection
image-processing
activiti
react-virtualized
raspberry-pi
mean-stack
maven-3
packages
jxls
ravendb
opengl-es-2.0
bs4
android-youtube-api
cross-validation
vault
spring-xd
imacros
correlation
ghc
visjs
tokenize
angular2-aot
sparse-matrix
fish
virtualdub
uninstall
dbclient
google-cloud-nl
frame
binary-data
xquery-3.0
google-sites-2016
avcapturesession
repo
openoffice.org
mozilla
html5-fullscreen
host
lto
az-application-insights
impersonation
streamreader
angularjs-factory
lumberjack
ruby-on-rails-3.1
core-plot
heightmap
slick-3.0
avconv
logparser
nstextview
pearson
imanage
hittest
account-kit
cubes
abcpdf9
jquery-filter
rotativa
login-control
moveit
hexdump
yaws
php-internals
ios4
energy
freedesktop.org
maven-tomcat-plugin
jmeter-maven-plugin
mutation-observers
drawbitmap
service-accounts
inmobi
e10s
apache-commons-net
javax.mail
google-style-guide
rdl
tld
funcunit
jquery-layout
valuechangelistener
kgdb
resty-gwt
cloud-connect
centos5
farseer
quartz-graphics
eclipse-memory-analyzer
rabl
hungarian-algorithm
drools-planner
google-email-migration
gdata-api
errai
spring-portlet-mvc
asyncfileupload
punbb
adk
whoosh
php-parser
gnu-prolog
gcj
krl
actionview
mongomapper
dmx512
jquery-ui-droppable
web-architecture
sef
avatar
premature-optimization
msdev
wsdl.exe

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile