What is the difference between an Inner Class and a Sub-Class?

Asked 19-Dec-2017
Viewed 1424 times

0

 What is the difference between an Inner Class and a Sub-Class?


1 Answer


0

The main difference between inner class and subclass is, An Sub-Class is a class which inherits all the non-private members of its parent Class. But an inner class is a class which is nested within another class, which rights for the class which is nesting it and it can access all variables and methods defined in the outer class.
Inner classes have the methods they want, whereas sub-classes have the methods of their parent class. And Sub-classes can, of course, define additional methods, but they'll always have those of their parent.