IsMethod Function |
Namespace: XSharp.RT
FUNCTION IsMethod( oObject AS Object, symMethod AS STRING ) AS LOGIC
public static bool IsMethod( Object oObject, string symMethod )
1CLASS Animal 2 EXPORT sound, weight 3CONSTRUCTOR(s, w) 4 sound := s 5 weight := w 6METHOD Speaks CLASS 7 QOut(sound) 8END CLASS 9 10CLASS Programmer 11 EXPORT language 12CONSTRUCTOR(lang) 13 language := lang 14METHOD Speaks 15 QOut(language) 16 QOut("Hello World") 17 QOut(Chr(7)) 18END CLASS 19Function Start() 20 LOCAL dog AS Animal 21 LOCAL hacker AS Programmer 22 dog := Animal{"Bark Bark!", 50} 23 hacker := Programmer{"VO"} 24 IF IsMethod(dog, #Speaks) 25 dog:Speaks() // Says Bark Bark 26 ENDIF 27 IF IsMethod(hacker, #Speaks) 28 // Says VO, Hello World, rings a bell 29 hacker:Speaks() 30 ENDIF