I had a question regarding casting objects. I have always used the following syntax to create an instance of a class
My java textbook is explaining implicit/explicit object casting and I need further clarification to feel warm and cozy.
By implicitly casting an object in this way, what is the difference between my code and the casting? I do understand that a Person() is always an instance of Object, but Object is not always an instance of Person(), but I guess I don't just quite grasp the reasoning behind it.
Person me = new Person();
My java textbook is explaining implicit/explicit object casting and I need further clarification to feel warm and cozy.
Object me = new Person();
By implicitly casting an object in this way, what is the difference between my code and the casting? I do understand that a Person() is always an instance of Object, but Object is not always an instance of Person(), but I guess I don't just quite grasp the reasoning behind it.