Would each instance of Foo create a new counter variable, or would it remain the same for all of them, i.e. baz.funky() would always use the same counter variable?
Would each instance of Foo create a new counter variable, or would it remain the same for all of them
It would remain the same for all of them.
What if the class was a template?
Templates are not classes. A template creates a new class for each instantiation of it. So Foo<int> and Foo<char> would be 2 entirely different classes. Therefore Foo<int>::funky() and Foo<char>::funky would be 2 entirely different functions, and therefore would each have their own variable.