Main programm:
#include<iostream>
#include<string>
using namespace std;
#include "klasse_methoden.cpp"
int main(){
postenTyp pEins;
pEins.werteZuweisen(5,2.5,"Working?");
pEins.ausgeben();
}
Class definition:
#include<string>
using namespace std;
class postenTyp{
private:
int anzahl;
double kommaZahl;
string name;
public:
void werteZuweisen(const int &, const double &, const string &);
void ausgeben();
};
Class Methods:
#include "klasse_definition.cpp"
#include<iostream>
void postenTyp::werteZuweisen(const int &a, const double &p, const string &b){
anzahl = a;
kommaZahl = p;
name = b;
}
void postenTyp::ausgeben(){
cout << "Anzahl: " << anzahl << "Kommazahl: " << kommaZahl << "Name: " << name << endl;
}
Compile error - multiple definition
The book teaches me to not include anything or using namespace in the class definition and class methods but then i get even more errors.