Same class scope Different
class scopes
Same signature NA
Overriding
Different signature Overloading Hiding
Here, different signatures means functions with same name, but with
different parameter types.
Sat
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Sorry about the mangled format in my previous post.
Here it goes again.
Is this a right classification to explain these method concepts as
four possible combinations of function siganture and class scope:
same signature & same class scope : Not applicable
same signature & different class scopes : Overriding
different signatures & same class scope : Overloading
different signatures & different class scopes : Hiding
Here, "different signatures" means functions with same name, but with
different parameter types.
Sat
Right.
> same signature & different class scopes : Overriding
This one is more complicated. Since you've demonstrated that making a
table is difficult to format, I'll answer with pseudocode. :)
if (type2 inherits from type1)
{
if (base signature is declared virtual)
{
return DERIVED_OVERRIDES_BASE;
}
else
{
return DERIVED_HIDES_BASE;
}
}
else
{
return COMPLETELY_UNRELATED_FUNCTIONS;
}
> different signatures & same class scope : Overloading
Yes.
> different signatures & different class scopes : Hiding
Yes, but only if there is an inheritance relationship between the
classes.
--
Chris