Sub classing is done with the help of inheritance. It is done for design purposes
Suppose you have a Chair class and you want to categories this further under RevolvingChair so, you need to extend the Chair class in RevolvingChair class.
Now you only need to implement the revolving feature revolve() in your RevolvingChair class, the other chair features will be already included from the parent class i.e.Chair Class
public Class Chair{ //chair properties // chair behavior and methods }
public class RevlovingChair extends Chair{ //extra properties for revolving chair, it also includes the properties of Chair class, we don't need to implement it again here.
// new methods (we don't need to implement chair methods here again) revolve() }
ANkita gupta
07-May-2015Anonymous User
07-May-2015ANkita gupta
07-May-2015