About message passing

As I understand it, message passing in OOP is just calling an object's method. Say you have a spaceship object and you call its move method to take it to another location. So far, so good.

However, I read that objects pass messages to one another, and I get confused. Isn't it the programmer who does this in main? I understand the concept of calling a method, of course, but how does an object call another object's method?

Sorry if this seems silly, but for some reason I'm having a difficult time understanding it.
Last edited on
Objects can contain sub-objects. So the object's methods (member functions) can call the methods from the sub-objects or, indeed, any object passed in as a parameter (part of the message) ti the function or any global object in scope.

Topic archived. No new replies allowed.