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.
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){ //... }
"Think not but that I know these things; or think
I know them not: not therefore am I short
Of knowing what I ought."
-John Milton, Paradise Regained (1671)
"Work hard and it might happen."
-XSquared
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?
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler