I have a class Node,then I created my tree node in my main
like this:
static void Main(string[] args)
{
Node IProot = new Node("ANY-IP");
}
I want to have access to this Node all the times even when I will go through another function(setting IProot global) for example I want to have
public static alarm generalize(alarm one,alarm two)
{
//some code
}
instead of
public static alarm generalize(alarm one,alarm two,Node IProot)
{
//some code
}
if this is totally wrong what should I do?
Because I don’t have access to IProot, I have to get it as an input to my function so that I can code with IProot,but it is much better for me to not get it as an input.
I tried static Node where I defined IProot in the main, but that resulted in an error. I also tried static class Node for my class, again no result.
Try this:
This instantiates the
IProotobject in your application’sMainmethod, and will allow that instance of the object to be accessible in the methods in your class.