I solved it follow the requirement. (and I just follow it, I dont really understand why I should do them to solve the problem)
The way to solve this problem seems be close to wrapper pattern.
I cannot tell the difference.
Any clue?
Thank you guys!!
Jen P
Level 26
How this implementation differenciate from "Wrapper" pattern from last lecture ?
Under discussion
Comments (2)
- Popular
- New
- Old
You must be signed in to leave a comment
Chris Hilborne
4 May 2020, 16:42
Hey! You're right that the design patters are similar but there is a key difference that I think I understand.
The difference as I see it that on the on hand a wrapper extends a 'parent' class and in doing so extends its functionality - by overriding some methods and adding new ones. Just think about all of the methods you can call on an Integer object - as opposed to an int.
On the other hand, an adaptor implements an interface and, at the same time, has a private object as its only field. When overrides the interface's methods - it calls other methods on its private field to allow for a cross-functionality between the object field and it's implemented interface. This providing an interface between the two.
That's how I see it anyway.
+3
ther23333
13 May 2020, 01:06
Thank u .
It's a great explanation
0