Something like this just arose in another question and aroused my interest. Given that it is Foo
declared as follows:
struct Foo
{
static void bar() {std::cout << "Bar!";}
};
doing something like this seems to be fine:
std::vector<Foo> v;
v[10].bar();
However, is this use legal? What if bar()
were not announced static
?
Knoep source
share