+ 1

Objects vs Instances

Upcasting: You can cast an instance of a subclass to its superclass. Downcasting: Casting an object of a superclass to its subclass is called downcasting. Why did the upcasting definition use the word "instance" and the downcasting definition use the word "object"? Are they supposed to mean different things?

31st Mar 2017, 1:02 PM
Pavitran
Pavitran - avatar
2 Respostas
+ 8
Object means the definition, instance is the object after instantiating the properties of it (after setting values to the attributes of an object). But I think these two terms are mixed up so often, that noone will care about using them as synonyms.
31st Mar 2017, 1:12 PM
Tashi N
Tashi N - avatar
31st Mar 2017, 2:41 PM
Sachin Artani
Sachin Artani - avatar