trying to see how structs and constructors work in header, implementation, and main files. Using constructor and default constructor. I get compilation error in mains.cpp of "undefined reference to 'numbers::numbers()'
In test.h I have:
#ifndef H_TEST
#define H_TEST
struct numbers{
int a;
int b;
numbers();
numbers(int x, int y);
};
#endif
In Numbers.cpp I have:
#include "test.h"
numbers::numbers()
{
a=0;
b=0;
}
numbers::numbers(int x, int y)
{
a=x;
b=y;
}
In mains.cpp I have:
#include<iostream>
#include "test.h"
using namespace std;
numbers num;//compilation error occurs here
int main()
{
return 0;
}