Let's say we have a program that works like this:
namespace Example
{
class Program
{
static void Main(string[] args)
{
Storage MainStorage = new Storage();
PrintData Printer = new PrintData();
Printer.GetStorage(MainStorage);
}
}
class Storage
{
//Stores some data
}
class PrintData
{
Storage storage;
public void GetStorage(Storage storage)
{
this.storage = storage;
}
public void Print()
{
//Prints data
}
}
}
It's just an example so the code wont be perfect but my question is in this instance does the GetStorage()
method make a copy of the MainStorage
object or does it make a reference to it?