I'm relatively new in this forum and to object oriented language so please forgive me if this seems kinda stupid. I just want to test calling a function, specifically a constructor, with arrays as arguments.
main source
#include <iostream>
#include "d.h"
using namespace std;
int main () {
double pos[2] = { 2, 3} ;
double speed[2] = { 0, 0} ;
double accel[2] = { 1, 0} ;
Body human(pos, speed, accel);
}
class header
#ifndef D_H
#define D_H
class Body {
public:
Body(double k[], double l[], double m[]);
~Body();
protected:
double p[2] ;
double v[2] ;
double a[2] ;
private:
};
#endif // D_H
class source
#include "d.h"
#include <iostream>
Body::Body (double k[], double l[], double m[])
: p(k) ,
v(l) ,
a(m)
{
//ctor
}
Body::~Body(){
}
I am getting the Build Messages:
undefined reference to 'Body::Body(double*, double*, double*)'
undefined reference to 'Body::~Body()'
Would be nice if someone could help me. How do I correctly use the arrays in my constructor? And why does the same problem apply to my deconstructor? It says the same when i completely delete the deconstructor (declaration AND implementation).