Value Type and Reference Type Analogy [Beginning]

I'm going to start a series of posts tagged [Beginning], to try and help new programmers, or anyone with an interest in programming understand concepts using real-world examples.

The first in this series, value types and reference types.

So, what is a value type?
msdn says:

Variables that are based on value types directly contain values.

more value types at msdn

And, what is a reference type?
msdn says:

Variables of reference types, referred to as objects, store references to the actual data.

more reference types at msdn

that's like defining the word the word, right? It seems like that's what everyone says for both... I think we can do better.

In simplest real-world forms:

value types are like money, cash, dinero, coin, dough...

you got the cash in your hand, now go buy an LCD TV!

reference types are like personal checks...

you got something in your hand, but you have to walk to the bank and turn that piece of paper into real money. (Now you can get your LCD TV)

Tags:
brian's picture
!

Thanks!

Submitted by brian on Tue, 05/25/2010 - 11:42pm.
Nice Example

Nice Example

Submitted by lokeshkumar (not verified) on Fri, 05/21/2010 - 5:47am.

About Brian


profile for bluevoodoo1 on Stack Exchange, a network of free, community-driven Q&A sites

Brian Canzanella brings you nifty tips and tricks for most things .NET. read more...

Readers / Stuff