現在、コードブロックで最初のプロジェクトを作成していますが、新しいクラスを生成すると、一連のエラーが表示されます。
コード:
#ifndef SERVICIO_H
#define SERVICIO_H
#include <iostream>
#include <string>
using namespace std;
class Servicio
{
public:
Servicio();
virtual ~Servicio();
int codigo Get[10]() { return [10]; }
void Set[10](int codigo val) { [10] = val; }
string nombre Get[10]() { return [10]; }
void Set[10](string nombre val) { [10] = val; }
float precio Get[10]() { return [10]; }
void Set[10](float precio val) { [10] = val; }
float comision Get[10]() { return [10]; }
void Set[10](float comision val) { [10] = val; }
protected:
private:
int codigo [10];
string nombre [10];
float precio [10];
float comision [10];
}
#endif // SERVICIO_H
そしてエラーログ:
|12|error: expected ';' at end of member declaration|
|12|error: 'Get' does not name a type|
|13|error: expected ',' or '...' before 'val'|
|13|error: declaration of 'Set' as array of functions|
|13|error: expected ';' at end of member declaration|
|14|error: expected ';' at end of member declaration|
|14|error: 'Get' does not name a type|
|15|error: expected ',' or '...' before 'val'|