W
WantToKnowMore
I'm calling a function with a class pointer without assigning to any
class object. Still it executes the function.
And note that with VS 2005 compiler its giving 2 different results on
2 different PCs. In one PC it gives run time error (expected) and in
another PC it executes !
#include <iostream>
using namespace std;
class foo
{
public:
void greet(){cout << "Hello" << endl;}
};
int main()
{
foo* f;
f->greet(); // In one PC this function getting executed with printing
"Hello". How ???
return 0;
}
class object. Still it executes the function.
And note that with VS 2005 compiler its giving 2 different results on
2 different PCs. In one PC it gives run time error (expected) and in
another PC it executes !
#include <iostream>
using namespace std;
class foo
{
public:
void greet(){cout << "Hello" << endl;}
};
int main()
{
foo* f;
f->greet(); // In one PC this function getting executed with printing
"Hello". How ???
return 0;
}