Method and system for calling a method in object-oriented language