从其他类文件调用方法 [英] call a method from a different class file
本文介绍了从其他类文件调用方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
您需要将引用传递给实现该方法的对象,除非它是静态的.
如果该方法是静态的,则可以执行以下操作:
AqM.Rmv(); // If AqM is the class name
hi. i have a class file called AqM.cs and i am working in PirM.cs. i want to call in PirM.cs the method "Rmv" from AqM.cs file ( the method is public ). thank you!
解决方案You'll need to pass a reference to an object that implements the method, unless it's static.
If the method is static, you can just do:
AqM.Rmv(); // If AqM is the class name
这篇关于从其他类文件调用方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文