I don't understand pointers, templates, polymorphism......

Pages: 123
closed account (zb0S216C)
Pointers are simple to understand. I took me a while to get the hang of them as well. So, here's my explanation of what a pointer is and what it's function is:

A pointer "points" to another variable that is stored within a cell in the system memory. If you refer to that pointer, it will show you or give you the value it's pointing to. However, if you use this code segment:

int *NewBlock( new int[ 3 ] );

you are pointing to a group of cells in the system's memory. If you refer to the second element, for example, it will show you the value stored in the cell where the second element is stored.

Addresses: If you use the ampersand operator( & ), you're asking for the address of the cell where the value of the given variable is located in memory. This is represented in a hexadecimal format.

I'm sorry if that didn't help but that's my best shot.
Last edited on
Topic archived. No new replies allowed.
Pages: 123