I currently have a derived class and a base class. How can I make the base class of the derived class equal to a base class that I have? Will a shallow copy work?
class Derived : Base
{
// all the code you had above, plus this:
public Derived(Base toCopy)
{
this.name = toCopy.name;
this.address = toCopy.address;
}
}
Derived d = new Derived(b);