Can someone please explain why the below code is able to call the SayHello function and print out "Hello".
The constructor and destructor never get called as there is no object actually created, so why then can I call the SayHello function??
class A
{
public:
A()
{
std::cout<<"In Constructor"<<std::endl;
};
~A()
{
std::cout<<"In Destructor"<<std::endl;
};
void SayHello()
{
std::cout<<"Hello"<<std::endl;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
A* a = nullptr;
a->SayHello();
return 0;
}