Date: Mon, 3 Apr 2023 11:40:44 +0100
On Mon, Apr 3, 2023 at 11:20 AM Ville Voutilainen
<ville.voutilainen_at_[hidden]> wrote:
>
> Looks like you're failing to see the point. When you write it
> correctly, that is,
>
> return ::Monkey::Func();
>
> you know that's a non-member function because it has a :: in the very
> beginning, so it can't
> be a member function of the current class or of a base class.
I understood the point. The counter-point I was making was that you
sometimes needed to prepend something more complicated than "::".
By the way "::Monkey" won't work if Monkey is inside another namespace:
https://godbolt.org/z/z8d3YWMoo
and copy-pasted:
namespace Frog {
namespace Monkey {
void Func(void) {}
class Lizard {
void Func(void) {}
void Func2(void)
{
return ::Monkey::Func();
}
};
}
}
<ville.voutilainen_at_[hidden]> wrote:
>
> Looks like you're failing to see the point. When you write it
> correctly, that is,
>
> return ::Monkey::Func();
>
> you know that's a non-member function because it has a :: in the very
> beginning, so it can't
> be a member function of the current class or of a base class.
I understood the point. The counter-point I was making was that you
sometimes needed to prepend something more complicated than "::".
By the way "::Monkey" won't work if Monkey is inside another namespace:
https://godbolt.org/z/z8d3YWMoo
and copy-pasted:
namespace Frog {
namespace Monkey {
void Func(void) {}
class Lizard {
void Func(void) {}
void Func2(void)
{
return ::Monkey::Func();
}
};
}
}
Received on 2023-04-03 10:40:53