So, I am writing code with a structure [in C ++] and I am not sure whether to implement the structure in the header file or in the source file.
The structure 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 this enough or is it a bad design? When I read on some websites, the structure is usually implemented in the header file,
but in the previous assignment that I had [in C], course staff provided us with a header file that included the ad in the structure and NOT the implementation.
I saw here other questions similar to this, but they really did not answer my question.
source
share