Problem with operator const char *

Valentin Bonnard bonnardv@pratique.fr
Sun Nov 1 00:02:00 GMT 1998


Martin Habbecke wrote:

> Code-Example:

[ irrelevant parts sniped ]

> class test {
>   operator const char *() { return &elem; }
> };
> 
> class test_derived : public test
> {
>   operator const char *() { return ⅆ}
> };
> 
> int main( void )
> {
>   test_derived bla;
>   (const char *) bla;
> }

> It's not really ambiguous, is it ??

I don't think it is.

>From FDIS 3.3.7  Name hiding [basic.scope.hiding]:

>  The declaration of a member in a  derived  class
>  (clause  _class.derived_)  hides the declaration of a member of a base
>  class of the same name; see _class.member.lookup_.

-- 

Valentin Bonnard                mailto:bonnardv@pratique.fr
info about C++/a propos du C++: http://pages.pratique.fr/~bonnardv/



More information about the Gcc-bugs mailing list