am3081
asked on
adding = and == to my class
I have a class thats really just a simple vector class called record that I use for a very specific function in a project I am working on, now it has a private int array value,
I want to be able to do this basically,
record a,b;
a.set(1,2,3,5);
b.set (3,2,5,1);
//where set just gives the private int array the values given as arguements
a=b;<-- this is the part I can't figure out, how do I add = to my list of class functions
and also
if(a==b)
execute such and such code.
I can't find this anywhere on the internet, I believe because I don't know what to search for exactly, if anyone could help me out with this I would be greatly appreciative.
I want to be able to do this basically,
record a,b;
a.set(1,2,3,5);
b.set (3,2,5,1);
//where set just gives the private int array the values given as arguements
a=b;<-- this is the part I can't figure out, how do I add = to my list of class functions
and also
if(a==b)
execute such and such code.
I can't find this anywhere on the internet, I believe because I don't know what to search for exactly, if anyone could help me out with this I would be greatly appreciative.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
class record {
public:
record& operator= (const record& r);
bool operator== (const record& r);
};