class function declarations
I'm having trouble with where I write the actual implementation for my functions. If I include them within the class braces, I can instantiate a class object from another .cpp file fine. However, if I move them out of the classes braces and just leave the prototypes, I get linking errors. I can leave them outside of the braces only if I declare them all inline (like they were when they were in the braces).
Here is my code:
Code:
#include <iostream.h>
#include <stdio.h>
class MP3File {
private:
FILE * mp3file;
bool initialized;
int bitRate;
public:
MP3File();
MP3File(FILE * file);
bool parseHeader();
bool hasBeenInitialized();
void printHeaderInformation();
};
inline MP3File :: MP3File(){ initialized = false; }
inline MP3File :: MP3File(FILE * file)
{
mp3file = file;
initialized = true;
}
inline bool MP3File :: parseHeader()
{
bitRate = 50;
return true;
}
inline bool MP3File :: hasBeenInitialized()
{
return initialized;
}
inline void MP3File :: printHeaderInformation()
{
cout << "Header information" << endl;
cout << "Bit Rate: " << bitRate << endl;
}
How can I eliminate making them inline but still be allowed to instantiate an MP3File object from another cpp file?
Thanks in advance.