0

What is the difference between subclass and object? Is subclass also an object of the class?

Is all objects are the subclass of a superclass

6th Dec 2017, 6:12 AM
Nikhila Tammu
Nikhila Tammu - avatar
3 Answers
+ 7
Object is an instance of a class. You can treat class definition as an instruction how the objects of this class are created, what variables and methods they hold and what they do. Subclasses inheriting from this class are simply modified instructions on how a slightly different type of objects are created. Themselves, subclasses are NOT instances of the superclass.
6th Dec 2017, 6:48 AM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
0
Is subclass also does not hold any info?
6th Dec 2017, 6:38 AM
Nikhila Tammu
Nikhila Tammu - avatar
- 1
Classes do not hold any information, while an object does.
6th Dec 2017, 6:15 AM
Saurabh Suman
Saurabh Suman - avatar