I thought of this forum while looking for clarification of a statement in java literature. The statement is;
"When you call an objects method, Java looks for that method definition in the object's class. If it doesn't find one, it passes the method call up the class hierarchy until it finds a method definition."
My confusion originates from trying to understand the purposeful reasoning for coding differently when coding for a class then when coding for an object.
I think the coding differences are due to class(s) are physically located in a different part of memory then where the object is placed, when the program is loading into memory.
The class is loaded into the "Data" section, while the object is loaded into the stack or heap.
Getting back to the statement in the Java literature.
If I am trying to call an object's method, the instantiated class, the objects blueprint, that method is in the stack or heap within its object.
So why would Java look for the objects' method, in different parts of the data section?