Calling class member through uninitialized class pointer
- by Adil
I have following code snippet:
class ABC{
public:
int a;
void print(){cout<<"hello"<<endl;}
};
int main(){
ABC *ptr = NULL:
ptr->print();
return 0;
}
It runs successfully. Can someone explain it?