R
Rick
One of the rules I have recommended for our new coding standard is as
follows:
"When overriding a base class virtual function, all overloads of that
base class virtual function should also be overridden. Otherwise, the
overloads of the overridden function in the base class will not be
visible from the derived class."
In other words...
class foo
{
public:
virtual int abc( int def );
virtual int abc( char ghi, int jkl );
};
class bar : public foo
{
public:
int abc( int def ); // << override of first abc in base class
};
I claim that virtual int abc( char ghi, int jkl ) in class foo is now
invisible to class bar and its users, i.e.:
int w;
char x;
int y;
bar z;
w = z.abc( x, y );
.... will not work.
But, I can't find any reference in Stroustrup (or anywhere else, so
far) that supports that claim.
Am I right or wrong?
If I am right, then I have been asked to provide a reference to
something that supports it, so if any of you happen to know of a
reference I can use (preferably to Stroustrup) that would be much
appreciated.
Thanks...
follows:
"When overriding a base class virtual function, all overloads of that
base class virtual function should also be overridden. Otherwise, the
overloads of the overridden function in the base class will not be
visible from the derived class."
In other words...
class foo
{
public:
virtual int abc( int def );
virtual int abc( char ghi, int jkl );
};
class bar : public foo
{
public:
int abc( int def ); // << override of first abc in base class
};
I claim that virtual int abc( char ghi, int jkl ) in class foo is now
invisible to class bar and its users, i.e.:
int w;
char x;
int y;
bar z;
w = z.abc( x, y );
.... will not work.
But, I can't find any reference in Stroustrup (or anywhere else, so
far) that supports that claim.
Am I right or wrong?
If I am right, then I have been asked to provide a reference to
something that supports it, so if any of you happen to know of a
reference I can use (preferably to Stroustrup) that would be much
appreciated.
Thanks...