List x; and List x();?

Go4Expert Member
13Mar2008,15:56   #1
heena.mca's Avatar
Is there any difference between List x; and List x();?
TechCake
13Mar2008,17:08   #2
asadullah.ansari's Avatar
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.
Go4Expert Member
13Mar2008,18:04   #3
ismail.tech21's Avatar
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)
   ...
 }