| Author |
Constructor in abstract class
|
mohan shetty
Greenhorn
Joined: Oct 26, 2007
Posts: 9
|
|
Hello All, Actually what is the use of having a constructor in an abstract class?
|
 |
Shiva Shankar
Ranch Hand
Joined: Dec 07, 2006
Posts: 31
|
|
|
when sub class implementing the abstract class,before subclass constructor is invoked, it calls the constructor in abstract super class.
|
 |
Peter Chase
Ranch Hand
Joined: Oct 30, 2001
Posts: 1970
|
|
As mentioned, a constructor is required in an abstract class, to allow the concrete subclass to be instantiated. However, not all possible access modifiers make sense for the constructor of an abstract class. The "public" modifier doesn't in practice offer any more access than "protected". The "private" modifier makes instantiation of a concrete subclass impossible; this only makes sense for a non-instantiable utility class (which is not very OO). Normally, therefore, the constructor of an abstract class will be "protected". Occasionally, it might be package-private.
|
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.<br /> <br />#:^P
|
 |
 |
|
|
subject: Constructor in abstract class
|
|
|