Hallo zusammen,
bin gerade noch fleissig am Lernen von C++ und habe folgende drei Files:
^- hier liegt wahrscheinlich auch der Hund begraben!
Das bringt mir beim Kompilieren, folgende Fehlermeldung:
$ clear && g++ -Wall -o bin/sammlung sammlung.cpp Film.cpp
sammlung.cpp:10: error: request for member ‘set_year’ in ‘f1’, which is of non-class type ‘Film ()()’
sammlung.cpp:11: error: request for member ‘get_year’ in ‘f1’, which is of non-class type ‘Film ()()’
bin gerade noch fleissig am Lernen von C++ und habe folgende drei Files:
Code:
// film.h
#include <iostream>
using namespace std;
class Film
{
private:
int year;
char country;
public:
//Konstruktoren
Film();
~Film();
Film(int,int);
//Methoden
void set_year(int);
void get_year()const;
};
^- hier liegt wahrscheinlich auch der Hund begraben!
Code:
// Film.cpp
#include <iostream>
#include "Film.h"
using namespace std;
Film::Film()
{
}
Film::~Film()
{
}
void Film::get_year()const
{
cout << year << endl;
return;
}
void Film::set_year(int jahr)
{
year = jahr;
return;
}
Code:
// sammlung.cpp
#include "Film.h"
#include <iostream>
using namespace std;
int main(void)
{
Film f1;
f1.set_year(1992);
f1.get_year();
return 0;
}
Das bringt mir beim Kompilieren, folgende Fehlermeldung:
$ clear && g++ -Wall -o bin/sammlung sammlung.cpp Film.cpp
sammlung.cpp:10: error: request for member ‘set_year’ in ‘f1’, which is of non-class type ‘Film ()()’
sammlung.cpp:11: error: request for member ‘get_year’ in ‘f1’, which is of non-class type ‘Film ()()’