Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Abstract Class versus an Interface, when no Members in Common

Reply
Thread Tools

Abstract Class versus an Interface, when no Members in Common

 
 
Daniel Pitts
Guest
Posts: n/a
 
      11-09-2011
On 11/8/11 2:15 PM, Wanja Gayk wrote:
> In article<3iYsq.9363$>,
> says...
>
>> Sounds almost like you want a visitor pattern instead, or an
>> intermediate object:
>>
>> public class SearchResult {
>> public boolean isSingleArray() { ... }
>> public boolean isMultipleArray() { ... }
>>
>> // Throws IllegalStateException if !isSingleArray
>> public SingleArray getSingleArray() { ... }
>> // Throws IllegalStateException if !isMutipleArray
>> public MultipleArray getMultipleArray() { ... }
>>
>> }

>
> That doesn't seem to be any better than the infamous instaceof-cascade -
> I'd rather say it's even uglier.

Being converted to a visitor pattern would be better, granted, but the
OP was extremely vague on the requirements.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can *common* struct-members of 2 different struct-types, that are thesame for the first common members, be accessed via pointer cast to either struct-type? John Reye C Programming 28 05-08-2012 12:24 AM
Re: Mozilla versus IE versus Opera versus Safari Peter Potamus the Purple Hippo Firefox 0 05-08-2008 12:56 PM
equal? versus eql? versus == versus === verus <=> Paul Butcher Ruby 12 11-28-2007 06:06 AM
what is the difference between abstract class and pure abstract class? skishorev@yahoo.co.in C++ 4 05-17-2006 08:07 AM
Deriving abstract class from non-abstract class Matthias Kaeppler Java 1 05-22-2005 01:28 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57