callAs
callAs(us_classs_genericFunctiong_arg1[g_arg2... ] ) =>g_value
Description
Calls a method specialized for some super class of the class of a given object directly, bypassing the usual method inheritance and overriding of a generic function.
It is an error if the given arguments do not satisfy the condition (classp g_obj us_class).
Arguments
|
A SKILL object whose class is us_class or a subclass of us_class. |
|
Value Returned
|
The result of applying the selected method to the given arguments. |
Examples
defclass( GeometricObj () ())
=> t
defclass( Point (GeometricObj ) () )
=> t
defgeneric( whoami (obj) println("default"))
=> t
defmethod( whoami (( obj Point )) println("Point"))
=> t
defmethod( whoami (( obj GeometricObj))
println( "GeometricObj"))
=> t
p = makeInstance( 'Point )
=> stdobj:0x325018
whoami(p) ;prints "Point"
=> nil
callAs( 'GeometricObj 'whoami p ) ;prints "GeometricObj"
=> nil
Related Topics
Return to top