It's been a while since I have written any C++, so when looking up some basic examples to get me started, I was surprised to see something like this:
#include <iostream>
class TestClass {
public:
void testMethod(){
std::cout << "Hello!";
}
};
int main()
{
TestClass test; // Not being instantiated
test.testMethod(); // Method still able to be called successfully!
}
How is it possible that a non-static method of a class can be called without an instance of the class being created first?
Working example: http://cpp.sh/3wdhg