G
Goran
Hi all!
Example here doesn't compile in both VC++ and gcc. It's like Get(int&)
somehow hides Get() in CDerived. Does anybody has an idea why?
class CBase
{
public:
int Get() const { int i; Get(i); return i;};
virtual bool Get(int& i) const { return false; }
};
class CDerived : public CBase
{
int j;
public:
virtual bool Get(int& i) const { i = j; return true; }
};
void WTF()
{
CDerived d;
int test = d.Get(); // error 2660: function does not take 0 arguments
// int test = d.CBase::Get(); works, but yuck!
CBase b;
test = b.Get(); // OK.
}
Thanks,
Goran,
Example here doesn't compile in both VC++ and gcc. It's like Get(int&)
somehow hides Get() in CDerived. Does anybody has an idea why?
class CBase
{
public:
int Get() const { int i; Get(i); return i;};
virtual bool Get(int& i) const { return false; }
};
class CDerived : public CBase
{
int j;
public:
virtual bool Get(int& i) const { i = j; return true; }
};
void WTF()
{
CDerived d;
int test = d.Get(); // error 2660: function does not take 0 arguments
// int test = d.CBase::Get(); works, but yuck!
CBase b;
test = b.Get(); // OK.
}
Thanks,
Goran,