如何将一个类中的方法调用到另一个类 [英] How to call a method in one class to another class

查看:223
本文介绍了如何将一个类中的方法调用到另一个类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

展开 | 选择 | Wrap | 行号

推荐答案

展开 | 选择 | Wrap | 行号



您尚未声明/创建第一个类的实例第二。尝试在构造函数中声明一个''first''类。
You have not declared/created an instance of the first class in the second. Try declaring a ''first'' class in the constructor.



他需要吗?该方法是静态的,因此不能由类而不是该类的对象调用。看看数学。要调用Math函数,您不需要声明实例。那是因为方法是静态的还是因为类是最终的?

Does he need to? The method is static so can''t it be called by the class instead of an object of that class. Take a look at Math. To call Math functions, you don''t need to declare an instance. Is that because the methods are static or because the class is final?



他需要吗?该方法是静态的,因此不能由类而不是该类的对象调用。看看数学。要调用Math函数,您不需要声明实例。那是因为方法是静态的还是因为类是最终的?
Does he need to? The method is static so can''t it be called by the class instead of an object of that class. Take a look at Math. To call Math functions, you don''t need to declare an instance. Is that because the methods are static or because the class is final?



我今天早上在太多文件之间切换,并没有全部阅读(因此我删除了一个无用的帖子;)。


:: sigh ::我试图削减,但我今天早上肯定需要咖啡......

I''m switching between too many documents this morning and didn''t read it all (hence my deletion of a useless post ;).

::sigh:: I was trying to cut back, but I definitely need coffee this morning...


这篇关于如何将一个类中的方法调用到另一个类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆