|
Boost : |
From: Brad King (brad.king_at_[hidden])
Date: 2001-06-27 11:07:19
> Consider this little tidbit of overload resolution:
>
> struct Foo {
> template<typename T> Foo& operator=(const T&);
> };
>
> struct Bar : public Foo {
> template<typename T> Bar(T);
> Bar& operator=(const Bar& other);
> };
>
> Bar b;
> b = 5;
>
> So what happens at b=5? Clearly the candidates are either:
> 1) a call to Foo::operator=(T). This requires:
> 2) a call to Bar::operator=(const Bar&)
I believe that Foo::operator= will never be considered because its name is
hidden by Bar::operator=.
-Brad
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk