如何从这个课堂上获得这个价值 [英] how to get this value from this class
本文介绍了如何从这个课堂上获得这个价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以帮我从其他对象访问date变量吗?
我不知道该怎么做.
感谢您提供任何提示.
Hi, can someone help me to access the date variable from other objects?
I dont know how to do this.
Thanks for any hints.
public class App : Ice.Application
{
public class ClockI : ClockDisp_
{
public override void tick(string date, Ice.Current current)
{
System.Console.Out.WriteLine(date);
string[] stringreceived = date.Split(',');
}
System.Console.WriteLine(intreceived);
}
}
[更正的代码格式]
[Corrected code formatting]
推荐答案
您能用更具体的语言来阐述您的问题吗?我得到的印象是,您要求从容器类的内部类访问变量.
如果我猜对了您的问题,那么您应该访问上述代码中的方法tick:
App.ClockI时钟=新的Ap.ClockI();
//clock.tick ....
Hi,
Can you elaborate your question by more specific language? I got impression like you are asking to access variable from inner class in a container class.
If I''m guessing right about your question then you should access method tick in above mentioned code:
App.ClockI clock = new Ap.ClockI();
// clock.tick....
我不知道日期变量来自
但是如果它从此类中获得价值的话
我认为最好的方法是将其公开,然后您可以获取或设置其值
i didn''t hnow date variable where came from
but if its get its value from this class
i think best way to do that be make it public and then you can get or set its value
public class App : Ice.Application
{
public class ClockI : ClockDisp_
{
public string date;
public override void tick(string tempdate, Ice.Current current)
{
date=tempdate;
System.Console.Out.WriteLine(date);
string[] stringreceived = date.Split('','');
}
System.Console.WriteLine(intreceived);
}
}
并以其他形式
App newapp=new App
所以你可以使用
newapp.date
and in other form
App newapp=new App
so you can use
newapp.date
这篇关于如何从这个课堂上获得这个价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文