지금이 두 파일을 얻었고 언제든지 컴파일하려고합니다. 문자열이 Bestellung.h에서 형식 오류의 이름을 지정하지 않습니다 std :: string name; 왜 ? 들으 MAIN.CPPstd :: 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 ::'를 사용하지 못합니다. –