Consider a struct
type defined as follows:
public struct Device
{
public string Name {get; set;}
public string Data {get; set;}
public void UploadData(DataSource source)
{
source.data += Data;
}
}
Now, I would like to change the Device
to a class
type and use it to describe different types of devices:
public class Device
{
public string Name {get; set;}
public string Data {get; set;}
public virtual void UploadData(DataSource source)
{
source.data += Data;
}
}
I'm aware that one should be cautious in making this step because the parameters are passed by reference in the second case. But somehow I can't figure out a use case where this change will have negative consequences for uploading data to the data source.