aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Decorator Pattern Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Decorator Pattern" Watch "Decorator Pattern" New topic
Author

Decorator Pattern

Maan Suraj
Ranch Hand

Joined: Dec 20, 2007
Posts: 293
I was going through decorator pattern from Head First. On one of the pages,it says that

" When i inherit behaviour by subclassing,that behaviour is set statically at compile time"


I am not getting what does "statically at compile time means in this context".




Man Suraj
Someone says "Impossible is nothing". The man next him says "Let me see you licking your elbow tip!"
ramesh maredu
Ranch Hand

Joined: Mar 15, 2008
Posts: 210

I read it long back,if I am correct, the book is comparing between inheritance and composition.

When you extend a class and make a subclass then you get the behavior of super class and the behavior is static (you can not change the behavior at runtime). But if you compose then the behavior you get with composed reference could be dynamic.








SCJP 1.5 94%.
The greatest glory in living lies not in never falling, but in rising every time we fall.
 
jQuery in Action, 2nd edition
 
subject: Decorator Pattern
 
Similar Threads
Decorator pattern
Deploying servlets as a war file
Decorator pattern
decorator pattern from HFDP
Decorator Pattern Vs Inheritance