I'm supposed to make my class cloneable for class, but I can't get it to work... Here's what I have so far:
public class Employeex : ICloneable
{
// using properties instead of the constructor
public int EmployeeID { get; set; }
public string Name { get; set; }
public int CurrentLocationID { get; set; }
public object Clone()
{
Employeex copy = new Employeex();
copy.EmployeeID = this.EmployeeID.Clone();
copy.Name = this.Name.Clone();
copy.CurrentLocationID = this.CurrentLocationID.Clone();
return copy;
}
}
And here is the code my professor gave us as a reference to use:
public class clsPendingCH : ICloneable
{
public double[] Samples;
public object Clone()
{
clsPendingCH copy = new clsPendingCH();
copy.Samples = (double[])this.Samples.Clone();
return copy;
}
}
I get an error saying 'int' does not contain a definition for 'Clone', and cannot convert type 'object' to 'string'. Anyone have any ideas?