Splitting up class definitions
Hello All!
I am attempting to split up a class into two files, a .h and a .cpp but I'm getting so many errors that it's mad. Basically I have in my header file:
Code:
#if !defined MY_CLASSES_H
#define MY_CLASSES_H
#include <string>
#include "date.h"
using namespace std;
class this_class
{
public:
this_class();
void function1();
int function2(int var1, float var2);
private:
int var1;
int var2;
date var3;
string var4;
};
class that_class : public this_class
{
public:
that_class();
date function3();
private:
int var5;
string var6;
};
and the .cpp has...
Code:
#include <iostream>
#include <string>
#include <fstream>
#include <time.h>
#include "date.h"
#include "functions.h"
#include "Bank_Acc.h"
using namespace std;
this_class::this_class()
{
//Do Stuff
}
void this_class::function1()
{
//More Stuff
}
........
date that_class::function3()
{
//Yet More Stuff
}
My compiler keeps telling me that I have one or more multiply defined symbols. Is it even possible to declare 2 classes in a header file and define their functions in a .cpp file? If do you have to define them each in their own header files with defined functions in seperate .cpp files and if so how do I make one class inherit the details of another class using this method (including the calling of the constructor for the parent class)?
Cheers for your help guys and gals!