In below code snippet, although pointer is not initialized the call is still made successfully
temp *ptr; ptr->func2();
Is it due to C++
Its not working. Its just by luck that your application is not crashing where your expecting it to crash. Its not a feature but a side-effect of the compiler which is allowing the function call to seem to work.