Is there any way to pass a variable of class in other class?
<p>I want two classes. I have a static variable in class <code>Class1</code> and I want to pass the value that it got to class <code>Class2</code>.</p>

<p>For Example :</p>

<pre><code>//Class1.h
{
    static int x;
    int Method1();
}

//Class1.cpp
{
    int Class1::x=0;
    int Class1::Method1(){
    x=2;
    }
}
</code></pre>

<p>Now Class2</p>

<pre><code>//Class2.cpp
{
   Class1 cls;
   cout&lt;&lt;cls.x&lt;&lt;endl;//it shows 0 value
}
</code></pre>
