Pointers without allocation
Hello,
Code:
class foo{
public:
void fun(){ /* do something */ };
};
int main(){
foo *pF;
pF->fun();
return 0;
}
How is fun() called when nothing has been allocated to the pointer? In c++ classes we've been taught that we need to allocate memory with the 'new' keyword, so how is this legal c++? I'm just finding out about this and I don't know what it's called, so I can't search for it. I don't remember reading anything about it in the books. Does this not cause data loss when nothing has been assigned to pF? what is its use?