Inner Class access

Viewed 5561

Can a class written in a method of another class(inner class), access the methods variables? I mean in the code below:

class A
{
  void methodA( int a )
  {
    class B
    {
      void processA()
      {
         a++;
      }
    };
     std::cout<<"Does this program compile?";
     std::cout<<"Does the value of the variable 'a' increments?";
  };

};

Is this legal?Does, the value of 'a' increments? Please suggest how.

Thanks, Pavan.

2 Answers
Related