C++
Programming and Technical
Is there any difference between List x; and List x();?
Read Solution (Total 1)
-
- A big difference!
Suppose that List is the name of some class. Then function f() declares a local List object called x:
void f()
{
List x; // Local object named x (of class List)
...
}
But function g() declares a function called x() that returns a List:
void g()
{
List x(); // Function named x (that returns a List)
...
}
- 11 years agoHelpfull: Yes(0) No(0)
C++ Other Question