I started programming in c, and then worked little bit on Java and c#.
- So my understanding of an object(instance of a class) is that its like a pointer to the instance stored in memory(may be which points to the first memory cell of the whole instance...similar to struct or array A[] has its initial address stored in A).
Is my above understanding correct?
Recently I have been going through differences b/n reference and pointer in c++. This is where it gets more confusing as I read more.Like:
When to use references vs. pointers
What are the differences between a pointer variable and a reference variable in C++?
Reading from the above I understand both are same except references gaurds you by not taking null.
One point I don't get is they say: Pointer variable can be reassigned after initializing, but reference variable cannot be.But I tested this scenario and compiler allows me to re-assign, does it depend on the compiler??. If at all it cannot be reassigned a different value, what is the use of 'pass by ref' at all(in c++)?
Also can someone suggest a reliable and cool online source for c++, like msdn for c#
And also it would be nice if there is an easy way to see the address stored in a reference variable in c++