I have been reading MSDN "C# classes and struct" this morning to try to better understand these two concepts.
A class is a reference type. When an object of the class is created, the variable to which the object is assigned holds only a reference to that memory. When the object reference is assigned to a new variable, the new variable refers to the original object. Changes made through one variable are reflected in the other variable because they both refer to the same data.
A struct is a value type. When a struct is created, the variable to which the struct is assigned holds the struct's actual data. When the struct is assigned to a new variable, it is copied. The new variable and the original variable therefore contain two separate copies of the same data. Changes made to one copy do not affect the other copy."--MSDN
Can someone please write few lines of example codes to illustrate this concept as I am a young high school girl trying to grasp OOP concept and explain to me ??
Reference and value( scenario): In a book, there is a page with a difficult terminology, which not everyone may understand, so the author decides to include the definition of the terminology in bracket(for those who are not familiar with the term). Is this like passing by value?
If the author had instead put page number reference in brackets right after the term, where readers not familiar with the term can browse to to find the meaning of the term, then would this be passing by reference?