| Author |
Restriction on parent class
|
faisal hameed
Ranch Hand
Joined: Jan 19, 2009
Posts: 48
|
|
//can we apply restriction on parent class that he cannot creat object of shape type
|
Regards, M Faisal Hameed
PUCIT, Pakistan
|
 |
Rakesh Enoch
Greenhorn
Joined: Jun 27, 2008
Posts: 23
|
|
|
Make Shape an Interface. Let other classes implement it. This way you cannot intantiate Shape Class.
|
Rakesh Enoch SCJP 1.5 86%
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
|
And if you can't make it an interface, make it abstract. An abstract class does not need to have any abstract methods, so all you need to do is add the abstract modifier to the class.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
 |
|
|
subject: Restriction on parent class
|
|
|