Thursday, 26 April 2018

Member variable & Local variable

Member variable & Local variable:

Member Variable:


Those variable that are declare inside a class are known as member variable.
These variable can be used inside all method of that’s class.

Local variable:


Those variable that are declare inside a method are known as local variable.
It can’t be used outside the method in which it is declared.
These variable must be initialize by the programmer.

Example:

Class var
{
            int a;          //member variable
           Void show ()
           {
                  Float b=10.0;  //local variable
           }
}

No comments:

Post a comment

Popular Posts