私は今これらの2つのファイルを取得し、いつでもコンパイルしたい文字列にBestellung.hの型エラーの名前を付けません。std :: string name;どうして ? THX main.cppにstd :: sting?文字列は型エラーの名前を付けません
#include "Bestellung.h"
#include <iostream>
using namespace std;
int main()
{
Bestellung();
cout << Bestellung{"maki"} << endl;// [maki,10€]
return 0;
}
Bestellung.cpp
#include "Bestellung.h"
Bestellung(string bestellV,double preisV=10){
name="bestell V";
preis="preis V";
};
string get_name const(Bestellung v) {
return Bestellung.name;
};
double get_preis const(Bestellung v){
return Bestellung.preis;
};
ostream& print(ostream&) const{
};
Bestellung.h
#ifndef BESTELLUNG_H
#define BESTELLUNG_H
#include <string>
#include <iostream>
class Bestellung{
private:
std::string name;
std::double preis;
public:
Bestellung(string,double=10);
string get_name const {
};
double get_preis const{
};
ostream& print(ostream&) const{
};
};
#endif
いくつかの場所で "bestellung.h"を使用すると、あなたは 'std ::'を必要としません。 –