I'm trying to have a getData function transfer all the objects it is holding in its array to a new array so that the new array can be used in a friend function to print the objects' information.

void Set::getData(Set& tempSet) const
     for (int i = 0; i < size; i++)
		tempSet[i] = set[i];

That code gives me this error: no match for 'operator[]' in 'tempSet'

What am I doing wrong? Thanks for any help in advance.

It would help to see the definition of your Set class. From your usage, I'm guessing that a Set object has a data member set[] ?
If so, then your assignment statement should be tempSet.set[i] = set[i];

Heres the definition:

class Set

	Time set[10];
	int size, place;

	Set (Time , int);
	bool addElement(Time&);
	bool isEmpty();
	bool isFull();
	void printSet() const;  
	void getData(Set&) const;
	void getSize(int);
	friend ostream& operator<< (ostream&, Set&);
	//friend istream& operator>> (istream&, Set&);
	//const Set operator>> (const Set&) const;
	//const Set operator+ (const Set&) const;
	//const Set operator* (const Set&) const;
	//const Set operator- (const Set&) const;


you could add the [] operator to your Set class if you want to keep your original syntax, e.g.

Time &operator[](const int index){return set[index];}

So, is a Time object (of which member set is) something that can be directly assigned? If so, then my first comment should work. Otherwise, do you have a method for setting Time objects?

couldn't you just use string copy. strcpy(orignal_variable,new_variable);

couldn't you just use string copy. strcpy(orignal_variable,new_variable);

that's what i thought.
however i get this error

1>warning C4996: 'strcpy' was declared deprecated
1>see declaration of 'strcpy'
1>Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'

did you have the right header file? cause it did say that strcpy was not declared

reading up on it it seems like it feels it is unsecure and could cause a buffer problem
strcpy_s rather than strcpy works

Mr Cool, GPXtC02 - what does strcpy( or its secure variant) have to do with this thread? At this point, the problem is to copy an array of some unknown type, for exactly 10 elements.

To put this to a rest:

Use these #define's to halt the many warnings given by
Visual C++ 2005/8 for use of "unsafe" string functions

see the link below for a full list of the functions that have
secure variations available


you should use memcpy instead of strcpy for this, if you use it, just keeps similar grouped stuff together