non-static vs. static function and variable
<p>I have one question about static and non-static function and variable.</p>

<p>1) non-static function access static variable. </p>

<p>It's OK!</p>

<pre><code>class Bar
{
public:

     static int i;

     void nonStaticFunction() {

         Bar::i = 10;

     }

};

int Bar::i=0;
</code></pre>

<p>2) non-static function access non-static variable</p>

<p>Definitely OK!</p>

<p>3) static function access static variable&amp;funciton</p>

<p>Definitely OK!</p>

<p>4) static function access non-static function</p>

<p>It's OK</p>

<pre><code>class Bar
{
public:
     static void staticFunction( const Bar &amp; bar)
     {
         bar.memberFunction();

     }

     void memberFunction() const
     {

     }

}
</code></pre>

<p>5) static function access non-static variable</p>

<p>It's OK or not OK? I am puzzled about this!</p>

<p>How about this example</p>

<pre><code>class Bar
{
public:
     static void staticFunction( Bar &amp; bar)
     {
         bar.memberFunction();

     }

     void memberFunction()
     {

         i = 0;
     }

     int i;

};
</code></pre>
