Sunday, August 23, 2009

Q. Are constructors inherited?Can a subclass call the parent's class constructor?When?
Ans. You cannot inherit a constructor. That is, you cannot create a instance of a subclass using a constructor of one of it's superclasses. One of the main reasons is because youprobably don't want to overide the superclasses constructor, which would be possible if they were inherited. By giving the developer the ability to override a superclassesconstructor you would erode the encapsulation abilities of the language.

Q. What are wrapped classes?
Ans. Wrapped classes are classes that allow primitive types to be accessed as objects.

No comments:

Post a Comment