Friday 24 February 2012

How does List r; differs from List r();? | C++

Suppose that Member is the name of some class. Then, function f() declares a local member object called r:
Example:
void f()
{
list r; //local object named r (of class member)
}
//But function g()declares a function called r()that returns a member:
void g(){
member r(); //Function named r(that returns a member)
}
In the preceding code snippet, r is declared as a local variable and the other r() is declared as a function. That is the main difference.