Patent ID: 6721807
Filing Date: 2004-04-13
Classification: G06F

Abstract:
A method for carrying out double dispatch in an object-oriented program having a plurality of objects, each object being an instance of a class and having at least one type, the plurality of objects communicating by sending messages, the method comprising the steps of:calling a first method on an object of a first type and passing, as a parameter, an object of a second type; attempting to downcast, for all statically known subclasses of the second type, the object of the second type to one of these statically known subclasses until a downcast succeeds, else, if no downcast succeeds, terminating the method; and if a downcast succeeds, performing the following steps: calling a first method on the object of the second type and passing, as a parameter, the object of the first type; calling a second method, specific to the object of the second type, on the object of the first type and passing, as a parameter, the object of the second type, wherein the object of the first type also has a type of one of a plurality of concrete classes that are descendants of the first type, and wherein the object of the second type also has a type of one of a plurality of concrete classes that are descendants of the second type; and executing behavior specific to the one concrete class of the first type and the one concrete class of the second type.