Giorgos P. wrote:
classname *ptr = new classname();
Any idea why the parenthesis in the end?I thought that " new " worked just
fine with the classname alone?
...
It depends on the type designated by 'classname'. Unfortunately, you
didn't provide any details about this type.
If 'classname' names a non-POD class type, the '()' makes no difference
whatsoever, i.e. 'new classname' and 'new classname()' do the same thing.
For POD types the '()' is essential - it causes the object to be
default-initialized, while 'new classname' will not initialize it at all.
--
Best regards,
Andrey Tarasevich
Brainbench C and C++ Programming MVP