Pointers in C\C++ can be cast to pointers of other valid types and manipulated with various
standard library functions or just plain pointer arithmetic.

    Example C\C++:

        int  number = 12345;
        unsigned char * charNumber = (unsigned  char*)&number;
 
        if(charNumber[0] = 0x31 )
              charNumber[0] = 0x0A;
 
        SomeClass* clazz = new SomeClass();
        unsigned char * pCharSomeClass = (unsigned char*)clazz;
        pCharSomeClass[0] = 0x00;
 
        memset(pCharSomeClass,0xFF,10);

                ..........

    The above mischief would be impossible in Java because
    you could never cast inappropriate types to one another. If
    the compiler doesn't catch it as an fatal error then any good
    JVM should catch it during code verify phase of class loading.
 
    cheers
    Chris.
 

Sohail Zafar wrote:

 Can some body tell me what is the difference between pointers in C++ and handles in java.RegardsSohail

Reply via email to