the problem stats" copy instructor: initializes a copy of an IntSet given another IntSet as a parameter. The new IntSet is a copy of the IntSet parameter.

i need to copy my class using a constructor. IntSet is the class which is a class for setting up arrays as true or false and other array manipulation. i was having a little trouble figuring how to do this, but was thinking of doing something along these lines...

public IntSet(IntSet(b))
{
      IntSet(b) = new IntSet(a);
}

You will need to extract the field values from the parameter object to set the fields in the new object.
More like this:

public IntSet(IntSet source)
{
    //copy source field value to this object
    this.Data = source.Data; // assumes that IntSet has a Data property
}

Which is used like this IntSet newSet = new IntSet(oldSet); in code.

If you wish to make a clone then you can also write a clone method.

public IntSet Clone()
{
    IntSet copy = new IntSet();
    // copy relevant field values here
    copy.Data = this.Data;
    return copy;
}

Which is used like this IntSet newSet = oldSet.Clone(); in code.

If you also wish to have both options then the Clone method can use the constructor to do the cloning.

public IntSet Clone()
{
    return new IntSet(this);
}

thank you very much, this helps me understand it a lot better

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.