Calling class member through uninitialized 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/03/24 4:33 UTC
Read the original article Hit count: 313

Filed under:

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

Related posts about c++