在我拥有的其他类的构造中,我需要在堆栈中推送值,但我无法得到它因为我必须有一个实例来使用它。我不能使用静态堆栈因为每次执行都必须... [英] in the constructer of the other classes I have, I need to push the value in the stack but I can't get to it cuz I must have an instance to use it .I cant use static stack cuz every execution must...

查看:86
本文介绍了在我拥有的其他类的构造中,我需要在堆栈中推送值,但我无法得到它因为我必须有一个实例来使用它。我不能使用静态堆栈因为每次执行都必须...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public class Execution
    {
        public int structur;
        public Stack<int> pileProg;
        public Execution()
        {
            pileProg = new Stack<int>();

        }
/*example of classes I want to use:*/

public class Constant 
       {
        private string Name;
        private string Value;

       public Constant(string Name,string Value)
        {
       this.Name=Name;
       this.Value=Value;
       /*here I want to push the value in the stack */
         }
        public string name
        {
       get{return Name;}
       set{ Name=value;}
         }  
         public string value
        {
       get{return Value;}
       set{ Value=value;}
         } 
    }

推荐答案

这篇关于在我拥有的其他类的构造中,我需要在堆栈中推送值,但我无法得到它因为我必须有一个实例来使用它。我不能使用静态堆栈因为每次执行都必须...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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