在控制台程序中设置标志 [英] Setting a Flag In a Console Program

查看:145
本文介绍了在控制台程序中设置标志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个控制台程序.我想创建一个可以从代码的一部分设置并由代码的另一部分检查的标志.我假设这是某种类型的变量,但是如何设置和取消设置此标志?谢谢.

I have a console program. I want to create a flag that can be set from one part of the code and checked by another part of the code. I assume that this is some type of variable, but how do I set and unset this flag? Thank you.

推荐答案

Richard MacCutchan-10 Oct 6''11
如果它在类中,则确保包含它的对象在方法之间传递.另外,对于简单程序,(不建议使用)您可以使用全局变量.
Richard MacCutchan - 6 Oct ''11
If it''s in a class then you make sure the object containing it gets passed around from method to method. Alternatively (and not recommended) for a simple program you could use a global variable.


这篇关于在控制台程序中设置标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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