【求助】不知道这个错误什么意思啊
c++吧
全部回复
仅看楼主
level 1
unexpected 'class Figure ('
unexpected token(s) preceding '{'; skipping apparent function body
unexpected 'class Line ('
unexpected token(s) preceding '{'; skipping apparent function body
2012年12月22日 07点12分 1
level 1
#include<iostream.h>
#include<stdio.h>
#include<windows.h>
#include <cstdlib>
///****************************************************************
enum TYPE {LINE, CIRCLE, ELLIPSE, ARC, RECTANGLE, TRIANGLE, POLYGON};
class FigureLink; // 超前声明
class Figure
{
friend class FigureLink; // FigureLink 是连接不同图形绘制类对象的链表类
protected:
TYPE type; // 图形类别:直线= LINE, 圆= CIRCLE, 椭圆=
// ELLIPSE, 弧= ARC, 矩形= RECTANGLE, 三角
// 形= TRIANGLE, 正多边形= POLYGON
int cx, cy; // 绘制图形的中心位置坐标
int linestyle; // 画线样式
int linewidth; // 画线宽度
int linecolor; // 画线颜色
int fillpattern; // 封闭图形的填充样式
int fillcolor; // 封闭图形的填充颜色
static Figure* ptr; // 指向将要插入链表的图形绘制对象
Figure* next; // 指向链表中下一个图形绘制对象
public:
Figure(int x, int y, TYPE tp, int style = SOLID_LINE, int lnwidth = NORM_WIDTH,
int lncolor = WHITE, int pattern = EMPTY_FILL, fcolor = BLACK)
{
cx = x;
cy = y;
type = tp;
linestyle = style;
fillpattern = pattern;
fillcolor = fcolor;
linewidth = lnwidth;
linecolor = lncolor;
}
virtual ~Figure() {}
virtual void Draw() = 0; // 图形绘制操作的接口规则
virtual void Insert() = 0; // 图形绘制类对象插入链表操作的接口规则
void show(); // 在图形方式下按指定格式显示图形的各项属性
//(中心位置坐标属性除外)。
};
//**********************************************************/
class Line:public Figure
{
private:
int length;
int angle;
public:
Line(int x, int y, TYPE tp, int style = SOLID_LINE, int lnwidth = NORM_WIDTH,
int lncolor = WHITE, int pattern = EMPTY_FILL, fcolor = BLACK,
int length = 300,int angle = 0)Figure(x, y, tp, style, lnwidth,
lncolor, pattern, fcolor)
{
Line::length=length;
Line::angle=angle
} };
没贴主函数,因为里面还没加和这些有关的东西
2012年12月22日 07点12分 2
level 1
忘了说了 所有错误都指在 构造函数上了
2012年12月22日 07点12分 3
1