Rooters,
I just ran into this problem again:
I have an object with two constructors. One takes
TPhCalKey(const TString &, const TString &, TDatime)
and the other takes:
TPhCalKey(const TString &, const TString &, Int)
If in CINT, I try to call this function with
TPhCalKey("String","String2",100)
it calls the first constructor, implicitly making a TDatime from an
Int.
All compilers I have used report no ambiguity and resolve to the second
function.
I realize that I can kludge around this by fixing the order of
declaration of the constructors, but I think this really ought to be
fixed in CINT. I know it's not a perfect ANSI interpreter, but proper
intuitive overload resolution is something that people expect to just
work, and when it doesn't, it can cause subtle, hard-to-find and
hard-to-fix bugs.
I also think that, at least on compilers conforming to the standard and
having the 'explicit' keyword, the TDatime constructor from an Int
ought to be declared as 'explicit'. Does CINT understand the explicit
keyword? If it did, this would also have fixed my particular problem...
George Heintzelman
gah@bnl.gov
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:21 MET