List x; and List x();?

heena.mca's Avatar, Join Date: Feb 2008
Go4Expert Member
Is there any difference between List x; and List x();?
asadullah.ansari's Avatar, Join Date: Jan 2008
TechCake
if List is class
then meaning of List x is that x is object of class List.
meaning of List x() is that x is a function which returns a object type List.
ismail.tech21's Avatar, Join Date: Feb 2008
Go4Expert Member
you can see the following example
Code:
void f()
 {
   List x;     // Local object named x (of class List)
   ...
 }

Code:
 void g()
 {
   List x();   // Function named x (that returns a List)
   ...
 }