Ok so, I'm writing a code with a struct [in C++], and I'm not sure whether to implement the struct in the header file or in the source file.
The struct includes a constructor:
struct Point
{
double x;
double y;
Point(double xCo, double yCo)
{
this->x = xCo;
this->y = yCo;
}
int comparePoint(Point point)
{
...
}
};
I wrote in the header file:
typedef struct Point point;
Is it good enough, or is it a bad design? As I read in some websites, a struct is usually implemented in the header file,
but in a previous assignment that I had [in C] the course's staff provided us with a header file that included declaration to the struct and NOT the implementation.
I saw other questions here similar to this one, but they didn't really answer my question.