嘿,我不确定我是否犯了语法错误,但我做了一个类,当我尝试编译它时得到这个错误....
dining.h:7:1: error: unknown type name ‘class’
dining.h:7:17: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
它适用于 g++ 但我必须使用 gcc ......
这是问题代码..
#ifndef DINING_H
#define DINING_H
class DiningSet {
public:
DiningSet();
~DiningSet();
void getSize(); // accepts X and Y dimentions of the table (in metres)
//void surfaceArea(int,int); // Calculates Surface Area of table (in square metres)
void numChairs(); // accepts number of chairs
void cushionColour(); // accepts a cushion colour
void woodType(); // accepts wood type
void priceComp(); // computes a price of set
void purchaseDet(); // displays details of purchase
void purchasePrice(); // displays price of purchace
private:
int X, Y; // Dimentions of table
float Surface;
int chairs; // Number of chairs
char colour; // colour of cushion (should be dynamic array)
char wood;
float totalPrice;
};
#endif