It's been about 4 years since I did much in C++. To see if I remembered anything, I made a new project, made a header file containing a class, included the header file from my main file, used pointers to dynamically allocate memory for a user-indicated number of class instances, and it was great!
Now... I used to always be sure to seperate my definition and declaration files. What I have is below and it works, BUT I would like to have three files: main.cpp, animal.h, and animal.cpp. I remember how to code everything. It's the preprocessor directives I cannot seem to get right. However In case a compiler issue arrises, I use Bloodshed's Dev-C++. :-)
main.cpp:
animal.h:
Once I create animal.cpp (already have, but cannot seem to include correctly), do I add a directive to the header file? To the new file?
Now... I used to always be sure to seperate my definition and declaration files. What I have is below and it works, BUT I would like to have three files: main.cpp, animal.h, and animal.cpp. I remember how to code everything. It's the preprocessor directives I cannot seem to get right. However In case a compiler issue arrises, I use Bloodshed's Dev-C++. :-)
main.cpp:
Code:
#include <animal.h> ...
Code:
#ifndef ANIMAL_H #define ANIMAL_H ... #endif
Comment