Im not sure if this question belongs in beginner section but i need help with how to link my classes to the rest of my code? I would put my code up but it is seperated into several files. I will use example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <iostream>
usingnamespace std;
//i want to move this class to a global file so that any of my files can create
//objects using the class and change the object things.
class Enemy{
public:
int health;
int damage;
};
int main(){
}
I was thinking something along the lines of this:
classFile.h:
1 2 3 4
#ifndef CLASSFILE
#define CLASSFILE
class Enemy;
#endif
classFile.cpp:
1 2 3 4 5 6 7 8
#include <iostream>
#include "classFile.h"
usingnamespace std;
class Enemy{
public:
int health;
int damage;
};