This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
This is a question from HF second edition page 735.
Which are true about the servlet Wrapper classes? (Choose all that apply.)
A. They provide the only mechanism for wrapping ServletResponse objects. B. They can be used to decorate classes that implement Filter. C. They can be used even when the application does NOT support HTTP. D. The API provides wrappers for ServletRequest, ServletResponse, and FilterChain objects. E. They implement the Intercepting Filter pattern. F. When you subclass a wrapper class, you must override at least one of the wrapper class�s methods.
The correct answer given in the book is C.
I thought answer F is correct as well. Is there a use of sub-classing a wrapper class, if we are not overriding at least one of the methods? How can we use a sub-classed wrapper with out overriding any methods?
Like to know everyone else opinion on this. Thanks.
there is a difference between what is legal and what's useful/efficient. So its legal to subclass any concrete class (in this case a wrapper)whithout overriding any of its methods. that does'nt mean it's useful though.
does this make it clear ?
Joined: May 11, 2008
Probably that's what they were trying to test. Thanks.