#ifndef IMAGE_H
#define IMAGE_H
usingnamespace std;
// a simple example - you would need to add more funtions
class ImageType {
public:
// functions irrelevant to the problem
void negateImage(/*stub*/);
ImageType& operator+(&ImageType);/*stub*/
ImageType& operator-(&ImageType);/*stub*/
ImageType& operator=(&ImageType);/*stub*/
when making references, the & comes after the typename. Just like your return type.
Also, your + and - operators probably shouldn't be returning a reference.
And you should also probably make this const correct while you're at it:
1 2 3 4 5 6 7
class ImageType {
public:
// functions irrelevant to the problem
void negateImage(/*stub*/);
ImageType operator+(const ImageType&) const; // const correct, doesn't return a reference
ImageType operator-(const ImageType&) const; // ditto
ImageType& operator=(const ImageType&); // this should return a reference
That was a rookie mistake on my part, but I'm still getting the "ISO C++ forbids declaration of `ImageType' with no type" error. Is there something wrong with the class specification?