Как создать правильно создать заголовочный файл для структур? Пытаюсь так, не выходит: structures.h
#ifndef LAB_8_STRUCTURES_H
#define LAB_8_STRUCTURES_H
struct Date;
struct Product;
#endif //LAB_8_STRUCTURES_H
structures.cpp
#include "structures.h"
struct Date {
int day;
int mon;
int year;
void init(int day, int mon, int year) {
this->day = day;
this->mon = mon;
this->year = year;
}
long getDays() {
int m[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
long days = (year - 1) * 365 + (year - 1) % 4;
for (int i = 0; i < mon; i++) {
days += m[i];
}
if (mon >= 1)
days++;
days += day;
return days;
}
};
struct Product {
char *name;
float weight;
float price;
Date exp;
void init(char *name, float weight, float price, Date exp) {
this->name = name;
this->weight = weight;
this->price = price;
this->exp = exp;
}
};
#endif