I'm getting this error, "Forbids Declaration of '___' with no type", for just about every function I have in my class and I have no idea what's wrong. Can any of you help me understand what's happening? I can elaborate more if needed.
Printable View
I'm getting this error, "Forbids Declaration of '___' with no type", for just about every function I have in my class and I have no idea what's wrong. Can any of you help me understand what's happening? I can elaborate more if needed.
It's also telling me that a few of my operators can not be overloaded. I'm just declaring them like this:
Code:Object operator[](int);
In my header file:
In my .cpp file:Code:int & operator[](int);
And that's how I have it set up.Code:Object::operator[](int index){
....
return &temp[0][0];
}
two things:
Also, you're returning a pointer, when you should be returning a reference (the compiler will complain when you fix the other errors).Code:int & Object::operator[](int index){
//...
}
I don't get it. In the header I already stated what it was going to return. So I have to do it in both files?