T
toadwarble
I hit on a question today which seemed to be incorrect to me in the
version of g++ I'm using (4.1.1)
I have the following
enum rectype_t {
// Stuff....
};
class recordclass {
// Stuff....
};
class base {
// Stuff.....
protected:
void add_record(const recordclass &);
};
class derived1 : public base {
// More stuff....
public:
void add_record(const rectype_t);
};
class derived2: public base {
// More stuff...
public:
void add_record(const rectype_t);
};
However when I define the "add_record" functions for derived1 and
derived2 thus:
void derived1::add_record(const rectype_t rt)
{
recordclass rec(rt);
// Fiddle with rec
add_record(rec);
}
It chokes on the "add_record" which was meant to be a call to the base
class version.
It's OK if I put base:add_record(rec) or if I change the name of the
base class function to "add_rec".
Am I wrong to think that is unambiguous overloading or is g++ wrong?
Thanks
John Collins
Xi Software Ltd
version of g++ I'm using (4.1.1)
I have the following
enum rectype_t {
// Stuff....
};
class recordclass {
// Stuff....
};
class base {
// Stuff.....
protected:
void add_record(const recordclass &);
};
class derived1 : public base {
// More stuff....
public:
void add_record(const rectype_t);
};
class derived2: public base {
// More stuff...
public:
void add_record(const rectype_t);
};
However when I define the "add_record" functions for derived1 and
derived2 thus:
void derived1::add_record(const rectype_t rt)
{
recordclass rec(rt);
// Fiddle with rec
add_record(rec);
}
It chokes on the "add_record" which was meant to be a call to the base
class version.
It's OK if I put base:add_record(rec) or if I change the name of the
base class function to "add_rec".
Am I wrong to think that is unambiguous overloading or is g++ wrong?
Thanks
John Collins
Xi Software Ltd