Calling class method through NULL class pointer
Posted
by Adil
on Stack Overflow
See other posts from Stack Overflow
or by Adil
Published on 2010-03-24T04:24:40Z
Indexed on
2010/05/11
17:14 UTC
Read the original article
Hit count: 314
c++
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?
© Stack Overflow or respective owner