| Author |
Inner and Abstract class
|
Anupama D S
Greenhorn
Joined: Jan 31, 2008
Posts: 4
|
|
Hi all Is it legal(not in terms of syntax) to define inner class inside abstract class does it comes under any design pattern?
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32654
|
|
You would appear to have missed the JavaRanch naming policy when you signed up. Please check it and amend your displayed name in "my profile." I think it is legal to declare such an inner class, yes, but if you give it private access it can only be used inside the abstract class. I don't know what pattern name you would put to that.
|
 |
Peter Chase
Ranch Hand
Joined: Oct 30, 2001
Posts: 1970
|
|
Originally posted by Anupama D S: Is it legal(not in terms of syntax) to define inner class inside abstract class does it comes under any design pattern?
If "not in terms of syntax", then what? Anyway, the answer is yes, it is legal to have an inner class inside an abstract class. Further, as well as being legal, it is also sometimes a reasonable thing to do. After all, an abstract class contains (partial) implementation code, and that implementation will sometimes be best achieved with the help of an inner class.
|
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.<br /> <br />#:^P
|
 |
Bill Shirley
Ranch Hand
Joined: Nov 08, 2007
Posts: 457
|
|
As stated, it would be perfectly reasonable to implement an abstract class, and have one or more inner classes that "complete" the implementation within the same file. Designs are just names that people have put to common design problem/solutions. It's just likely not that common.
|
Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
|
 |
 |
|
|
subject: Inner and Abstract class
|
|
|