title: Global variable inside the class and local function variable
body: <p>I tried out a c++ program, where i declared a variable of type int named "a" inside a class. And created a function named "b" inside which again i declared a variable named "a" and assigned the value to it.  The variable "a" inside the function is considered as local variable. And if i want to assign the value to the variable a which is present in the class definition(not inside the function), how can i do it?</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  class a{
      public:int a;//need to assign value for this "a" inside the function how can i do it
      int b(){
          int a=5;
          a=7;
          cout&lt;&lt;a;
      }
  };
  int main() {
      a A;
      A.b();
  }
  </code></pre>