Re: Calling a parameterless constructor from a parametered one

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday 18 Apr 2005 11:59, Grigory Zagorodnev wrote:
> Fred Labrosse wrote:
> >    baseClass(T val)
> >
> >       : theVal(val)
>
> ...
>
> > //    baseClass(T val)
> > //       : baseClass()
>
> You've got two constructors with identical arguments list so them failed
> to overload.
>
>

Sorry, should have been clearer.  I meant commenting out the first 
parameterised constructor and replacing it with the second (which in effect 
in that case does the same thing).  If I do that, I get:

g++ test.cpp
test.cpp: In constructor `baseClass<T, defaultVal>::baseClass(T) [with T = 
int,T defaultVal = 5]':
test.cpp:41:   instantiated from here
test.cpp:18: error: type `class baseClass<int, 5>' is not a direct base of 
`baseClass<int, 5>'

Cheers,

Fred

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux