dereferencing question

Pages: 12
An object is simply a piece of memory with a type (not necessarily class type). A pointer to an object contains the address to where the object is stored in memory. The type information is normally not stored inside the object but is handled by the compiler at compile time. The compiler knows that an int* points to an int so when you dereference an int* it knows that it should interpret the memory that the pointer points to as an int. Dereferencing in itself doesn't really do anything. It's just the syntax that you have to use in order to access the object that the pointer points to. What really happens depends on what operations you perform on the object.
Last edited on
thank you Peter that hit the nail on the head

MB posted :
The simple answer is that an object is an instance of a class.
but also a struct as well.

The struct having public member access by default and class having private member access as default.
Last edited on
but also a struct as well.

The struct having public member access by default and class having private member access as default.

Correct. With the exception of the default member access, you can consider "struct" to be synonymous with "class".
Last edited on
Topic archived. No new replies allowed.
Pages: 12