class - References and objects in C# -


i writing assignment school. have trouble on how should comment different parts of application.

i need read files, , therefore use streamreader class.

when write this

streamreader reader; 

i have trouble defining did. c# yellow book rob miles defines similar code

account robsaccount; 

what when program obeys line creation of reference called robsaccount.

he follows analogy luggage tag

you can think of them bit luggage tag, in can tied piece of rope. if have tag can follow rope object tied to.

when rob miles write later on

robsaccount = new account(); 

he describes as

(...)creating instance of class , connecting our tag it.

robsaccount = new account(); 

is similar case, write

reader = new streamreader(file, encoding.default); 

after reading couple of different books on c#, still cannot confidently comment called what. seem use different names , different analogies.

so question is:

what suitable comment this

streamreader reader; 

and suitable comment this

reader = new streamreader(file, encoding.default); 

my programming teacher says when write

streamreader reader; 

you making variable of type streamreader name reader. variable pointer (hence, reference) object created writing

new streamreader(file, encoding.default); 

is right way describe it?

streamreader reader; 

this variable declaration.

reader = new streamreader(file, encoding.default); 

here instantiating variable "reader" object of streamreader class.