I've been searching through other forums and questions but I can't seem to find an answer that relates to my issue. I keep getting this error that says "Redefinition of 'Shape'" in the .cpp file and it comes up for both constructors and functions.
Shape.h
#ifndef SHAPE_H
#define SHAPE_H
#include <iostream>
using namespace std;
class Shape {
private:
string name;
public:
Shape();
Shape(string name);
string getName() const;
friend ostream& operator << (ostream& output, const Shape & shape);
};
#endif // SHAPE_H
Shape.cpp
#include <iostream>
#include "Shape.h"
using namespace std;
Shape::Shape() {
this->name = "Shape";
}
Shape::Shape(string name) {
this->name = name;
}
string Shape::getName() const {
return name;
}
ostream& operator << (ostream& output, const Shape & shape) {
output << shape.getName();
return output;
}