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() }
WHAT ISSUBCLASSING? IS IT SAME AS SUBCLASS OR THEIR IS DIFFERENCE?
Liked By
Write Answer
Class
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy
Join MindStick Community
You have need login or register for voting of answers or question.
ANkita gupta
07-May-2015Anonymous User
07-May-2015ANkita gupta
07-May-2015