Home Segments Index Top Previous Next

237: Mainline

In general, when you send a message to a receiver, Smalltalk finds a method with a name that matches the message selector. To find a method, Smalltalk first determines whether a matching method is defined for the receiver's class. Next, if no matching method is defined for the receiver's class, Smalltalk determines whether a matching method is defined for the receiver's direct superclass. Then, if no matching method is found in the direct superclass, Smalltalk continues up the class hierarchy, class by class, until Smalltalk finds a matching method or reaches the end of the superclass chain. If no matching method is found, Smalltalk reports an error.