class object
{
public:
void check()
{
std::cout<<\"I am doing ok...\"<
To add a little to what others have said, try using a member variable of your class inside the check() method and then see what happens.
Function calling in case of classes is similar to normal function calling except for one little difference. The arguments are pushed on stack in both cases but in case of a function call of an object, 'this' is pushed on to the stack as the first argument. This 'this' is used inside function to access the member variables. Since you are not accessing any member variables, it is working. And yes, it can work even if you access member variables but you will get unexpected behavior because compiler is free to use the memory that was allocated to 'p'. As soon as compiler will utilize that memory, you will start getting crashes. For example, if you declare further variables after deleting before reusing 'p', it might crash.
Edit: Furthermore, if your method is not accessing any member variable, then it is a definite candidate to be a static method.