[LC++]g++ thinks default-constructed object is actually a function

Dr Mark H Phillips mark at austrics.com.au
Wed Apr 7 11:08:01 UTC 2004


Hi,

I know that if we do:

  Apple apple();

then C++ interprets apple as a function taking no arguments and 
returning an Apple object.  If we actually wanted apple to
be an Apple object, constructed using the default constructor,
then we should have done:

  Apple apple;

But I've come across a situation where g++ (version 3.2.2) thinks
I'm trying to define a function when really I'm trying to use
a default constructor --- but in this situation just leaving off
the brackets doesn't help!

I've attached the example program.  I'd be interested in people's
ideas.

Thanks,

Mark.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: bart.cc
Type: text/x-c++
Size: 1914 bytes
Desc: not available
Url : http://lists.linux.org.au/pipermail/tuxcpprogramming/attachments/20040407/7722f06e/attachment.bin 


More information about the tuxCPProgramming mailing list