
On 16 June 2010 22:06, Chad Nelson <chad.thecomfychair@gmail.com> wrote:
...and it worked. But I don't understand why it failed in the first place. Those two function names are unique in the class, and they're obviously inherited because I can call them from outside the class. Why aren't they visible without the base class name from *within* the combined class?
Because when the compiler is handling the template (rather than an instantiation of the template), the base classes can be arbitrarily specialized, so it has no idea what's in them. At the same time, it wants to be able to give as many error messages as it can, so you don't have to wait until you instantiate the member function to find out that you typed get_bats() instead of get_bits. So its compromise is that if you use an identifier that's not clearly a member, it will give an error message. As you've found out, you can make something clearly a member by saying type::foo or this->bar. And before all the language lawyers wince at my hand-waving, see Jeffrey's reply for a more precise answer.